Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
roncodes committed Sep 10, 2024
1 parent 3e0a43d commit 7aced9b
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 0 deletions.
9 changes: 9 additions & 0 deletions addon/helpers/format-milliseconds.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { helper } from '@ember/component/helper';

export default helper(function formatMilliseconds([milliseconds]) {
if (!milliseconds || typeof milliseconds !== 'number') {
return '-';
}

return milliseconds.toString().startsWith(0) ? `${milliseconds.toFixed(3).substring(2)}ms` : `${milliseconds.toFixed(3)}s`;
});
1 change: 1 addition & 0 deletions app/helpers/format-milliseconds.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from '@fleetbase/ember-ui/helpers/format-milliseconds';
17 changes: 17 additions & 0 deletions tests/integration/helpers/format-milliseconds-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'dummy/tests/helpers';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';

module('Integration | Helper | format-milliseconds', function (hooks) {
setupRenderingTest(hooks);

// TODO: Replace this with your real tests.
test('it renders', async function (assert) {
this.set('inputValue', '1234');

await render(hbs`{{format-milliseconds this.inputValue}}`);

assert.dom().hasText('1234');
});
});
6 changes: 6 additions & 0 deletions tests/unit/services/dashboard-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ module('Unit | Service | dashboard', function (hooks) {

// TODO: Replace this with your real tests.
test('it exists', function (assert) {
// register dummy services
this.owner.register('service:store', {}, { instantiate: false });
this.owner.register('service:fetch', {}, { instantiate: false });
this.owner.register('service:notifications', {}, { instantiate: false });
this.owner.register('service:intl', {}, { instantiate: false });
this.owner.register('service:universe', {}, { instantiate: false });
let service = this.owner.lookup('service:dashboard');
assert.ok(service);
});
Expand Down

0 comments on commit 7aced9b

Please sign in to comment.