diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2024-01-31 08:38:30 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-31 13:38:30 +0000 |
commit | 87ed7c8affd3ade9d3cd2d9ed1a61dd5f224e473 (patch) | |
tree | be727294e31ef21e8a3f634734610e69e4a155ac /test/profile-conditions-util.test.js | |
parent | 3e419aa562aab03ca20421aaf7e4d1a39194a5b4 (diff) |
Module refactoring (#588)
* Convert PronunciationGenerator into static functions
* Convert DictionaryDataUtil into static functions
* Convert AnkiNoteDataCreator into static functions
* Convert MediaUtil into static functions
* Convert RegexUtil into static functions
* Convert StringUtil into static functions
* Convert ArrayBufferUtil into static functions
* Convert AnkiUtil into static functions
* Convert PermissionsUtil into static functions
* Convert ProfileConditionsUtil into static functions
Diffstat (limited to 'test/profile-conditions-util.test.js')
-rw-r--r-- | test/profile-conditions-util.test.js | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/test/profile-conditions-util.test.js b/test/profile-conditions-util.test.js index 7af5f223..fcd53939 100644 --- a/test/profile-conditions-util.test.js +++ b/test/profile-conditions-util.test.js @@ -17,7 +17,7 @@ */ import {describe, expect, test} from 'vitest'; -import {ProfileConditionsUtil} from '../ext/js/background/profile-conditions-util.js'; +import {createSchema, normalizeContext} from '../ext/js/background/profile-conditions-util.js'; /** */ function testNormalizeContext() { @@ -50,8 +50,7 @@ function testNormalizeContext() { ]; test.each(data)('normalize-context-test-%#', ({context, expected}) => { - const profileConditionsUtil = new ProfileConditionsUtil(); - const actual = profileConditionsUtil.normalizeContext(context); + const actual = normalizeContext(context); expect(actual).toStrictEqual(expected); }); }); @@ -1101,14 +1100,13 @@ function testSchemas() { /* eslint-enable no-multi-spaces */ test.each(data)('schemas-test-%#', ({conditionGroups, expectedSchema, inputs}) => { - const profileConditionsUtil = new ProfileConditionsUtil(); - const schema = profileConditionsUtil.createSchema(conditionGroups); + const schema = createSchema(conditionGroups); if (typeof expectedSchema !== 'undefined') { expect(schema.schema).toStrictEqual(expectedSchema); } if (Array.isArray(inputs)) { for (const {expected, context} of inputs) { - const normalizedContext = profileConditionsUtil.normalizeContext(context); + const normalizedContext = normalizeContext(context); const actual = schema.isValid(normalizedContext); expect(actual).toStrictEqual(expected); } |