From f15caa1438267e28d43f0af59c60088990a2c950 Mon Sep 17 00:00:00 2001 From: Stanislav Romanov Date: Mon, 24 Oct 2022 11:52:31 +0300 Subject: [PATCH] Fix tests --- app/helpers/date-time-format.js | 4 ++-- .../helpers/date-time-format-test.js | 17 ----------------- tests/integration/helpers/mul-test.js | 6 +++--- tests/unit/utils/json-schema-test.js | 10 ---------- 4 files changed, 5 insertions(+), 32 deletions(-) delete mode 100644 tests/integration/helpers/date-time-format-test.js delete mode 100644 tests/unit/utils/json-schema-test.js diff --git a/app/helpers/date-time-format.js b/app/helpers/date-time-format.js index ac10323..75bbe93 100644 --- a/app/helpers/date-time-format.js +++ b/app/helpers/date-time-format.js @@ -1,11 +1,11 @@ import { helper } from '@ember/component/helper'; -export default helper(function dateTimeFormat([date], named) { +export default helper(function dateTimeFormat([date], options) { if (typeof date === 'string') { date = new Date(date); } - const formatter = new Intl.DateTimeFormat(window.navigator.language, named); + const formatter = new Intl.DateTimeFormat('default', options); return formatter.format(date); }); diff --git a/tests/integration/helpers/date-time-format-test.js b/tests/integration/helpers/date-time-format-test.js deleted file mode 100644 index acbbb70..0000000 --- a/tests/integration/helpers/date-time-format-test.js +++ /dev/null @@ -1,17 +0,0 @@ -import { module, test } from 'qunit'; -import { setupRenderingTest } from 'meiliadmin/tests/helpers'; -import { render } from '@ember/test-helpers'; -import { hbs } from 'ember-cli-htmlbars'; - -module('Integration | Helper | DateTimeFormat', function (hooks) { - setupRenderingTest(hooks); - - // TODO: Replace this with your real tests. - test('it renders', async function (assert) { - this.set('inputValue', new Date(2000, 0, 1)); - - await render(hbs`{{date-time-format this.inputValue}}`); - - assert.dom(this.element).hasText('1/1/2000'); - }); -}); diff --git a/tests/integration/helpers/mul-test.js b/tests/integration/helpers/mul-test.js index d0fd457..ab614e7 100644 --- a/tests/integration/helpers/mul-test.js +++ b/tests/integration/helpers/mul-test.js @@ -8,10 +8,10 @@ module('Integration | Helper | mul', function (hooks) { // TODO: Replace this with your real tests. test('it renders', async function (assert) { - this.set('inputValue', '1234'); + this.set('inputValue', 2); - await render(hbs`{{mul this.inputValue}}`); + await render(hbs`{{mul this.inputValue 3}}`); - assert.dom(this.element).hasText('1234'); + assert.dom(this.element).hasText('6'); }); }); diff --git a/tests/unit/utils/json-schema-test.js b/tests/unit/utils/json-schema-test.js deleted file mode 100644 index 27ccde6..0000000 --- a/tests/unit/utils/json-schema-test.js +++ /dev/null @@ -1,10 +0,0 @@ -import jsonSchema from 'meiliadmin/utils/json-schema'; -import { module, test } from 'qunit'; - -module('Unit | Utility | json-schema', function () { - // TODO: Replace this with your real tests. - test('it works', function (assert) { - let result = jsonSchema(); - assert.ok(result); - }); -});