Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@ const path = require('path');
module.exports = buildEngine({
name,

// Lazy loading keeps the engine out of the host bundle, but it also keeps the
// engine's modules out of the dummy app that `ember test` builds, so every test
// importing `@fleetbase/storefront-engine/*` fails to load. Eager loading is
// scoped to `ember test` run from this package, so host apps consuming the
// engine, including their own test builds, keep lazy loading. Addon index
// files are evaluated before ember-cli assigns EMBER_ENV, hence the argv check.
lazyLoading: {
enabled: true,
enabled: !(process.argv.includes('test') && process.cwd() === __dirname),
},

isDevelopingAddon() {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"@babel/core": "^7.23.2",
"@fleetbase/ember-core": "^0.3.25",
"@fleetbase/ember-ui": "^0.4.5",
"@fleetbase/fleetops-data": "^0.2.3",
"@fleetbase/fleetops-data": "^0.2.2",
"@fortawesome/ember-fontawesome": "^2.0.0",
"@fortawesome/fontawesome-svg-core": "6.4.0",
"@fortawesome/free-brands-svg-icons": "6.4.0",
Expand All @@ -61,6 +61,7 @@
"devDependencies": {
"@babel/eslint-parser": "^7.22.15",
"@babel/plugin-proposal-decorators": "^7.23.2",
"@ember/legacy-built-in-components": "^0.4.2",
"@ember/optional-features": "^2.0.0",
"@ember/test-helpers": "^3.2.0",
"@embroider/test-setup": "^3.0.2",
Expand All @@ -71,7 +72,6 @@
"broccoli-funnel": "^3.0.8",
"broccoli-merge-trees": "^4.2.0",
"concurrently": "^8.2.2",
"ember-classic-decorator": "^3.0.0",
"ember-cli": "~5.4.1",
"ember-cli-clean-css": "^3.0.0",
"ember-cli-dependency-checker": "^3.3.2",
Expand Down
84 changes: 47 additions & 37 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions tests/dummy/app/services/intl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import IntlService from 'ember-intl/services/intl';

/**
* ember-intl builds a formatter for every bundled locale when the service is
* created. Headless Chrome ships no number-format data for some of them
* (Mongolian among them), which ember-intl's default handler turns into a thrown
* error inside whichever test first touches intl. Missing locale data and
* missing translations are not what any test here checks, so both are ignored.
*/
export default class DummyIntlService extends IntlService {
onIntlError(error) {
if (error?.code === 'MISSING_DATA' || error?.code === 'MISSING_TRANSLATION') {
return;
}

super.onIntlError(error);
}
}
14 changes: 14 additions & 0 deletions tests/dummy/config/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,20 @@ module.exports = function (environment) {
},
},

// `@fleetbase/ember-core`'s application adapter reads `config.API.host` at

// module scope, so the dummy application must declare it before any

// adapter module can even be evaluated. The values are deliberately

// obviously-fake: nothing in the suite performs a real request.

API: {
host: 'https://api.fleetbase.test',

namespace: 'int/v1',
},

APP: {
// Here you can pass flags/options to your application instance
// when it is created
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/components/shared-identity-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module('Integration | Component | shared identity components', function (hooks)
});

test('a driver identity cell renders the name, status dot and vehicle badge from the shared descriptor', async function (assert) {
this.set('row', { driver_assigned: { resourceType: 'driver', name: 'Ada Driver', status: 'available', vehicle_name: 'Truck 10' } });
this.set('row', { driver_assigned: { resourceType: 'driver', name: 'Ada Driver', status: 'available', online: true, vehicle_name: 'Truck 10' } });
this.set('column', { resourceType: 'driver', resourcePath: 'driver_assigned', popover: false });

await render(hbs`<Table::Cell::Identity @row={{this.row}} @column={{this.column}} />`);
Expand Down Expand Up @@ -52,7 +52,7 @@ module('Integration | Component | shared identity components', function (hooks)
`);

assert.dom('[data-test-customer] [data-test-resource-pill-title]').hasText('Ava Chen');
assert.dom('[data-test-customer] [data-test-resource-pill-subtitle]').hasText('Customer');
assert.dom('[data-test-customer] [data-test-resource-pill-subtitle]').hasText('Contact', 'the polymorphic type reads as a person would say it');
assert.dom('[data-test-driver] [data-test-resource-pill-title]').hasText('Ada Driver');
assert.dom('[data-test-driver] [data-test-resource-pill-subtitle]').hasText('+15550100');
assert.dom('[data-test-place] [data-test-resource-pill-title]').hasText('Depot');
Expand Down
Loading