summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJames Maa <jmaa@berkeley.edu>2024-05-31 08:06:52 -0700
committerGitHub <noreply@github.com>2024-05-31 15:06:52 +0000
commit76ca08bd59f0e8bfa1bb20ac813f48e7ab241265 (patch)
treebdba43d9ba704885383c7f308c6fe3f574c647c5 /test
parentb3f54747eb2694bdc90bce72e5532e99d374ef08 (diff)
Allow trailing commas in ESLint (#1013)
* Update comma-dangle rule * Fix dangling commas
Diffstat (limited to 'test')
-rw-r--r--test/ajv-schemas.test.js4
-rw-r--r--test/anki-template-renderer.test.js24
-rw-r--r--test/cache-map.test.js16
-rw-r--r--test/core.test.js80
-rw-r--r--test/data/html/js/html-test-utilities.js2
-rw-r--r--test/database.test.js14
-rw-r--r--test/dictionary-data-validate.test.js2
-rw-r--r--test/dictionary-data.test.js2
-rw-r--r--test/document-util.test.js12
-rw-r--r--test/dom-text-scanner.test.js6
-rw-r--r--test/eslint-config.test.js22
-rw-r--r--test/fixtures/anki-template-renderer-test.js2
-rw-r--r--test/fixtures/dom-test.js6
-rw-r--r--test/fixtures/language-transformer-test.js2
-rw-r--r--test/fixtures/translator-test.js4
-rw-r--r--test/handlebars.test.js6
-rw-r--r--test/hotkey-util.test.js6
-rw-r--r--test/japanese-util.test.js288
-rw-r--r--test/json-schema.test.js466
-rw-r--r--test/json.test.js6
-rw-r--r--test/language-transformer-cycles.test.js4
-rw-r--r--test/language/albanian-transforms.test.js10
-rw-r--r--test/language/english-transforms.test.js22
-rw-r--r--test/language/japanese-transforms.test.js106
-rw-r--r--test/language/latin-transforms.test.js14
-rw-r--r--test/language/spanish-transforms.test.js14
-rw-r--r--test/mocks/common.js6
-rw-r--r--test/object-property-accessor.test.js34
-rw-r--r--test/options-util.test.js220
-rw-r--r--test/playwright/integration.spec.js4
-rw-r--r--test/playwright/playwright-util.js22
-rw-r--r--test/profile-conditions-util.test.js662
-rw-r--r--test/search-display-controller.test.js4
-rw-r--r--test/utilities/anki.js10
-rw-r--r--test/utilities/translator.js6
35 files changed, 1054 insertions, 1054 deletions
diff --git a/test/ajv-schemas.test.js b/test/ajv-schemas.test.js
index 49545c17..102868dc 100644
--- a/test/ajv-schemas.test.js
+++ b/test/ajv-schemas.test.js
@@ -59,8 +59,8 @@ describe('Ajv schema compilation', () => {
logger: {
log,
warn: log,
- error: log
- }
+ error: log,
+ },
});
standaloneCode(ajv);
if (messages.length > 0) {
diff --git a/test/anki-template-renderer.test.js b/test/anki-template-renderer.test.js
index d8d2a3b5..bf18dd0d 100644
--- a/test/anki-template-renderer.test.js
+++ b/test/anki-template-renderer.test.js
@@ -34,7 +34,7 @@ describe('AnkiTemplateRenderer', () => {
tags: [],
stats: {},
definitions: [],
- frequencies: []
+ frequencies: [],
},
resultOutputMode: 'split',
mode: 'test',
@@ -47,43 +47,43 @@ describe('AnkiTemplateRenderer', () => {
fullQuery: 'query.full',
sentence: {
text: 'sentence.query.full',
- offset: 9
- }
+ offset: 9,
+ },
},
- media: void 0
- }
+ media: void 0,
+ },
};
const testCases = [
{
name: 'regexMatch 1',
template: '{{#regexMatch "test" "gu"}}this is a test of regexMatch{{/regexMatch}}',
- result: 'test'
+ result: 'test',
},
{
name: 'regexMatch 2',
template: '{{regexMatch "test" "gu" "this is a test of regexMatch"}}',
- result: 'test'
+ result: 'test',
},
{
name: 'regexMatch 3',
template: '{{#if (regexMatch "test" "gu" "this is a test of regexMatch")}}true{{else}}false{{/if}}',
- result: 'true'
+ result: 'true',
},
{
name: 'regexReplace 1',
template: '{{#regexReplace "test" "TEST" "gu"}}this is a test of regexReplace{{/regexReplace}}',
- result: 'this is a TEST of regexReplace'
+ result: 'this is a TEST of regexReplace',
},
{
name: 'regexReplace 2',
template: '{{regexReplace "test" "TEST" "gu" "this is a test of regexReplace"}}',
- result: 'this is a TEST of regexReplace'
+ result: 'this is a TEST of regexReplace',
},
{
name: 'regexReplace 3',
template: '{{#if (regexReplace "test" "" "gu" "test")}}true{{else}}false{{/if}}',
- result: 'false'
- }
+ result: 'false',
+ },
];
describe.each(testCases)('$name', ({template, result: expectedResult}) => {
test('Test', ({expect, ankiTemplateRenderer}) => {
diff --git a/test/cache-map.test.js b/test/cache-map.test.js
index e7a8b836..2a3f5377 100644
--- a/test/cache-map.test.js
+++ b/test/cache-map.test.js
@@ -38,7 +38,7 @@ describe('CacheMap', () => {
{
maxSize: 1,
expectedSize: 0,
- calls: []
+ calls: [],
},
{
maxSize: 10,
@@ -48,8 +48,8 @@ describe('CacheMap', () => {
{func: 'has', args: ['a1-b-c'], returnValue: false},
{func: 'set', args: ['a1-b-c', 32], returnValue: void 0},
{func: 'get', args: ['a1-b-c'], returnValue: 32},
- {func: 'has', args: ['a1-b-c'], returnValue: true}
- ]
+ {func: 'has', args: ['a1-b-c'], returnValue: true},
+ ],
},
{
maxSize: 10,
@@ -60,8 +60,8 @@ describe('CacheMap', () => {
{func: 'set', args: ['a1-b-c', 64], returnValue: void 0},
{func: 'get', args: ['a1-b-c'], returnValue: 64},
{func: 'set', args: ['a2-b-c', 96], returnValue: void 0},
- {func: 'get', args: ['a2-b-c'], returnValue: 96}
- ]
+ {func: 'get', args: ['a2-b-c'], returnValue: 96},
+ ],
},
{
maxSize: 2,
@@ -81,9 +81,9 @@ describe('CacheMap', () => {
{func: 'set', args: ['a3-b-c', 3], returnValue: void 0},
{func: 'has', args: ['a1-b-c'], returnValue: false},
{func: 'has', args: ['a2-b-c'], returnValue: true},
- {func: 'has', args: ['a3-b-c'], returnValue: true}
- ]
- }
+ {func: 'has', args: ['a3-b-c'], returnValue: true},
+ ],
+ },
];
/* eslint-enable @stylistic/no-multi-spaces */
diff --git a/test/core.test.js b/test/core.test.js
index 178f509a..3a9d1995 100644
--- a/test/core.test.js
+++ b/test/core.test.js
@@ -32,7 +32,7 @@ describe('DynamicProperty', () => {
expectedDefaultValue: 0,
expectedValue: 0,
expectedOverrideCount: 0,
- expectedEventOccurred: false
+ expectedEventOccurred: false,
},
{
operation: 'set.defaultValue',
@@ -40,7 +40,7 @@ describe('DynamicProperty', () => {
expectedDefaultValue: 1,
expectedValue: 1,
expectedOverrideCount: 0,
- expectedEventOccurred: true
+ expectedEventOccurred: true,
},
{
operation: 'set.defaultValue',
@@ -48,7 +48,7 @@ describe('DynamicProperty', () => {
expectedDefaultValue: 1,
expectedValue: 1,
expectedOverrideCount: 0,
- expectedEventOccurred: false
+ expectedEventOccurred: false,
},
{
operation: 'set.defaultValue',
@@ -56,7 +56,7 @@ describe('DynamicProperty', () => {
expectedDefaultValue: 0,
expectedValue: 0,
expectedOverrideCount: 0,
- expectedEventOccurred: true
+ expectedEventOccurred: true,
},
{
operation: 'setOverride',
@@ -64,7 +64,7 @@ describe('DynamicProperty', () => {
expectedDefaultValue: 0,
expectedValue: 8,
expectedOverrideCount: 1,
- expectedEventOccurred: true
+ expectedEventOccurred: true,
},
{
operation: 'setOverride',
@@ -72,7 +72,7 @@ describe('DynamicProperty', () => {
expectedDefaultValue: 0,
expectedValue: 8,
expectedOverrideCount: 2,
- expectedEventOccurred: false
+ expectedEventOccurred: false,
},
{
operation: 'setOverride',
@@ -80,7 +80,7 @@ describe('DynamicProperty', () => {
expectedDefaultValue: 0,
expectedValue: 32,
expectedOverrideCount: 3,
- expectedEventOccurred: true
+ expectedEventOccurred: true,
},
{
operation: 'setOverride',
@@ -88,7 +88,7 @@ describe('DynamicProperty', () => {
expectedDefaultValue: 0,
expectedValue: 32,
expectedOverrideCount: 4,
- expectedEventOccurred: false
+ expectedEventOccurred: false,
},
{
operation: 'clearOverride',
@@ -96,7 +96,7 @@ describe('DynamicProperty', () => {
expectedDefaultValue: 0,
expectedValue: 32,
expectedOverrideCount: 3,
- expectedEventOccurred: false
+ expectedEventOccurred: false,
},
{
operation: 'clearOverride',
@@ -104,7 +104,7 @@ describe('DynamicProperty', () => {
expectedDefaultValue: 0,
expectedValue: 32,
expectedOverrideCount: 2,
- expectedEventOccurred: false
+ expectedEventOccurred: false,
},
{
operation: 'clearOverride',
@@ -112,7 +112,7 @@ describe('DynamicProperty', () => {
expectedDefaultValue: 0,
expectedValue: 64,
expectedOverrideCount: 1,
- expectedEventOccurred: true
+ expectedEventOccurred: true,
},
{
operation: 'clearOverride',
@@ -120,10 +120,10 @@ describe('DynamicProperty', () => {
expectedDefaultValue: 0,
expectedValue: 0,
expectedOverrideCount: 0,
- expectedEventOccurred: true
- }
- ]
- }
+ expectedEventOccurred: true,
+ },
+ ],
+ },
];
describe.each(data)('Test DynamicProperty($initialValue)', ({initialValue, operations}) => {
@@ -156,110 +156,110 @@ describe('deepEqual', () => {
{
value1: 0,
value2: 0,
- expected: true
+ expected: true,
},
{
value1: null,
value2: null,
- expected: true
+ expected: true,
},
{
value1: 'test',
value2: 'test',
- expected: true
+ expected: true,
},
{
value1: true,
value2: true,
- expected: true
+ expected: true,
},
{
value1: 0,
value2: 1,
- expected: false
+ expected: false,
},
{
value1: null,
value2: false,
- expected: false
+ expected: false,
},
{
value1: 'test1',
value2: 'test2',
- expected: false
+ expected: false,
},
{
value1: true,
value2: false,
- expected: false
- }
+ expected: false,
+ },
];
/** @type {import('test/core').DeepEqualTestData} */
const simpleObjectTestsData = [
{
value1: {},
value2: {},
- expected: true
+ expected: true,
},
{
value1: {},
value2: [],
- expected: false
+ expected: false,
},
{
value1: [],
value2: [],
- expected: true
+ expected: true,
},
{
value1: {},
value2: null,
- expected: false
- }
+ expected: false,
+ },
];
/** @type {import('test/core').DeepEqualTestData} */
const complexObjectTestsData = [
{
value1: [1],
value2: [],
- expected: false
+ expected: false,
},
{
value1: [1],
value2: [1],
- expected: true
+ expected: true,
},
{
value1: [1],
value2: [2],
- expected: false
+ expected: false,
},
{
value1: {},
value2: {test: 1},
- expected: false
+ expected: false,
},
{
value1: {test: 1},
value2: {test: 1},
- expected: true
+ expected: true,
},
{
value1: {test: 1},
value2: {test: {test2: false}},
- expected: false
+ expected: false,
},
{
value1: {test: {test2: true}},
value2: {test: {test2: false}},
- expected: false
+ expected: false,
},
{
value1: {test: {test2: [true]}},
value2: {test: {test2: [true]}},
- expected: true
- }
+ expected: true,
+ },
];
/** @type {import('test/core').DeepEqualTestData} */
const recursiveTestsData = [
@@ -274,8 +274,8 @@ describe('deepEqual', () => {
x.x = x;
return x;
})(),
- expected: false
- }
+ expected: false,
+ },
];
describe('simple tests', () => {
test.each(simpleTestsData)('deepEqual($value1, $value2) -> $expected', ({value1, value2, expected}) => {
diff --git a/test/data/html/js/html-test-utilities.js b/test/data/html/js/html-test-utilities.js
index 34e58807..c6011e6d 100644
--- a/test/data/html/js/html-test-utilities.js
+++ b/test/data/html/js/html-test-utilities.js
@@ -161,7 +161,7 @@ class HtmlTestUtilities {
if (template !== null && templateContentContainer !== null) {
const mode = (container instanceof HTMLElement ? container.dataset.shadowMode : void 0);
const shadow = templateContentContainer.attachShadow({
- mode: (mode === 'open' || mode === 'closed' ? mode : 'open')
+ mode: (mode === 'open' || mode === 'closed' ? mode : 'open'),
});
const containerStyles = document.querySelector('#container-styles');
diff --git a/test/database.test.js b/test/database.test.js
index 9d57ecab..6eed863a 100644
--- a/test/database.test.js
+++ b/test/database.test.js
@@ -115,7 +115,7 @@ describe('Database', () => {
const title = testDictionaryIndex.title;
const titles = new Map([
- [title, {priority: 0, allowSecondarySearches: false}]
+ [title, {priority: 0, allowSecondarySearches: false}],
]);
// Setup database
@@ -156,7 +156,7 @@ describe('Database', () => {
{name: 'invalid-dictionary3'},
{name: 'invalid-dictionary4'},
{name: 'invalid-dictionary5'},
- {name: 'invalid-dictionary6'}
+ {name: 'invalid-dictionary6'},
];
describe.each(invalidDictionaries)('Invalid dictionary: $name', ({name}) => {
test('Has invalid data', async ({expect}) => {
@@ -185,7 +185,7 @@ describe('Database', () => {
const title = testDictionaryIndex.title;
const titles = new Map([
- [title, {priority: 0, allowSecondarySearches: false}]
+ [title, {priority: 0, allowSecondarySearches: false}],
]);
// Setup database
@@ -198,7 +198,7 @@ describe('Database', () => {
const {result: importDictionaryResult, errors: importDictionaryErrors} = await dictionaryImporter.importDictionary(
dictionaryDatabase,
testDictionarySource,
- {prefixWildcardsSupported: true}
+ {prefixWildcardsSupported: true},
);
if (importDictionaryResult) {
@@ -309,7 +309,7 @@ describe('Database', () => {
/** @type {{clearMethod: 'purge'|'delete'}[]} */
const cleanupTestCases = [
{clearMethod: 'purge'},
- {clearMethod: 'delete'}
+ {clearMethod: 'delete'},
];
describe.each(cleanupTestCases)('Testing cleanup method $clearMethod', ({clearMethod}) => {
test('Import data and test', async ({expect}) => {
@@ -336,7 +336,7 @@ describe('Database', () => {
await dictionaryDatabase.deleteDictionary(
testDictionaryIndex.title,
1000,
- () => { progressEvent2 = true; }
+ () => { progressEvent2 = true; },
);
expect(progressEvent2).toBe(true);
}
@@ -351,7 +351,7 @@ describe('Database', () => {
/** @type {import('dictionary-database').DictionaryCounts} */
const countsExpected = {
counts: [],
- total: {kanji: 0, kanjiMeta: 0, terms: 0, termMeta: 0, tagMeta: 0, media: 0}
+ total: {kanji: 0, kanjiMeta: 0, terms: 0, termMeta: 0, tagMeta: 0, media: 0},
};
expect.soft(counts).toStrictEqual(countsExpected);
diff --git a/test/dictionary-data-validate.test.js b/test/dictionary-data-validate.test.js
index a8d9f1ab..30f67bf5 100644
--- a/test/dictionary-data-validate.test.js
+++ b/test/dictionary-data-validate.test.js
@@ -42,7 +42,7 @@ describe('Dictionary validation', () => {
{name: 'invalid-dictionary3', valid: false},
{name: 'invalid-dictionary4', valid: false},
{name: 'invalid-dictionary5', valid: false},
- {name: 'invalid-dictionary6', valid: false}
+ {name: 'invalid-dictionary6', valid: false},
];
const schemas = dictionaryValidate.getSchemas();
describe.each(testCases)('Test dictionary $name', ({name, valid}) => {
diff --git a/test/dictionary-data.test.js b/test/dictionary-data.test.js
index bf2d0ace..e55496e4 100644
--- a/test/dictionary-data.test.js
+++ b/test/dictionary-data.test.js
@@ -50,7 +50,7 @@ describe('Dictionary data', () => {
data,
expected1: expectedResults1[i],
expected2: expectedResults2[i],
- expected3: expectedResults3[i]
+ expected3: expectedResults3[i],
}));
describe.each(testCases)('Test %#: $data.name', ({data, expected1, expected2, expected3}) => {
test('Test', async ({window, translator, expect}) => {
diff --git a/test/document-util.test.js b/test/document-util.test.js
index 0f541e12..8add2b97 100644
--- a/test/document-util.test.js
+++ b/test/document-util.test.js
@@ -135,7 +135,7 @@ describe('Document utility tests', () => {
sentenceScanExtent,
sentence,
hasImposter,
- terminateAtNewlines
+ terminateAtNewlines,
} = parseJson(/** @type {string} */ (testElement.dataset.testData));
const elementFromPointValue = querySelectorChildOrSelf(testElement, elementFromPointSelector);
@@ -174,8 +174,8 @@ describe('Document utility tests', () => {
* @param {number} index
* @returns {DOMRect}
*/
- item: function item(index) { return this[index]; }
- }
+ item: function item(index) { return this[index]; },
+ },
);
return domRectList;
};
@@ -186,7 +186,7 @@ describe('Document utility tests', () => {
const textSourceGenerator = new TextSourceGenerator();
const source = textSourceGenerator.getRangeFromPoint(0, 0, {
deepContentScan: false,
- normalizeCssZoom: true
+ normalizeCssZoom: true,
});
switch (resultType) {
case 'TextSourceRange':
@@ -229,7 +229,7 @@ describe('Document utility tests', () => {
terminateAtNewlines2,
terminatorMap,
forwardQuoteMap,
- backwardQuoteMap
+ backwardQuoteMap,
).text;
expect(sentenceActual).toStrictEqual(sentence);
@@ -257,7 +257,7 @@ describe('Document utility tests', () => {
expectedResultNodeSelector,
expectedResultNodeIsText,
expectedResultOffset,
- expectedResultContent
+ expectedResultContent,
} = parseJson(/** @type {string} */ (testElement.dataset.testData));
/** @type {?Node} */
diff --git a/test/dom-text-scanner.test.js b/test/dom-text-scanner.test.js
index 4ec3a44d..e9d3405c 100644
--- a/test/dom-text-scanner.test.js
+++ b/test/dom-text-scanner.test.js
@@ -105,7 +105,7 @@ function createAbsoluteGetComputedStyle(window) {
result = result.replace(/([-+]?\d(?:\.\d)?(?:[eE][-+]?\d+)?)em/g, replacer);
}
return result;
- }
+ },
});
};
}
@@ -138,8 +138,8 @@ describe('DOMTextScanner', () => {
node: expectedNodeSelector,
offset: expectedOffset,
content: expectedContent,
- remainder: expectedRemainder
- }
+ remainder: expectedRemainder,
+ },
} = testDataItem;
const node = querySelectorTextNode(testElement, nodeSelector);
diff --git a/test/eslint-config.test.js b/test/eslint-config.test.js
index 6ea6715a..3b93fa98 100644
--- a/test/eslint-config.test.js
+++ b/test/eslint-config.test.js
@@ -37,7 +37,7 @@ async function getDependencies(scriptPaths) {
target: 'es2022',
format: 'esm',
write: false,
- metafile: true
+ metafile: true,
});
const dependencies = Object.keys(v.metafile.inputs);
const stringComparer = new Intl.Collator('en-US'); // Invariant locale
@@ -90,35 +90,35 @@ const targets = [
{
name: 'sandbox',
paths: [
- 'ext/js/templates/template-renderer-frame-main.js'
+ 'ext/js/templates/template-renderer-frame-main.js',
],
/** @type {import('test/eslint-config').MinimalEslintConfigEnv} */
env: {
- webextensions: false
- }
+ webextensions: false,
+ },
},
{
name: 'worker',
paths: [
- 'ext/js/dictionary/dictionary-worker-main.js'
+ 'ext/js/dictionary/dictionary-worker-main.js',
],
/** @type {import('test/eslint-config').MinimalEslintConfigEnv} */
env: {
browser: false,
- worker: true
- }
+ worker: true,
+ },
},
{
name: 'serviceworker',
paths: [
- 'ext/js/background/background-main.js'
+ 'ext/js/background/background-main.js',
],
/** @type {import('test/eslint-config').MinimalEslintConfigEnv} */
env: {
browser: false,
- serviceworker: true
- }
- }
+ serviceworker: true,
+ },
+ },
];
describe('Eslint configuration', () => {
diff --git a/test/fixtures/anki-template-renderer-test.js b/test/fixtures/anki-template-renderer-test.js
index 1e3ec74e..1ad72d7f 100644
--- a/test/fixtures/anki-template-renderer-test.js
+++ b/test/fixtures/anki-template-renderer-test.js
@@ -38,7 +38,7 @@ export async function createAnkiTemplateRendererTest() {
// It is needed for DOM access for structured content.
void window;
await use(ankiTemplateRenderer);
- }
+ },
});
return result;
}
diff --git a/test/fixtures/dom-test.js b/test/fixtures/dom-test.js
index 364612f6..55353a5d 100644
--- a/test/fixtures/dom-test.js
+++ b/test/fixtures/dom-test.js
@@ -31,7 +31,7 @@ function prepareWindow(window) {
/** @returns {string} */
get() { return this.textContent; },
/** @param {string} value */
- set(value) { this.textContent = value; }
+ set(value) { this.textContent = value; },
});
// Placeholder for feature detection
@@ -51,7 +51,7 @@ export async function setupDomTest(htmlFilePath) {
prepareWindow(window);
return {
window,
- teardown: (global) => environment.teardown(global)
+ teardown: (global) => environment.teardown(global),
};
}
@@ -73,6 +73,6 @@ export function createDomTest(htmlFilePath) {
} finally {
await environment.teardown(global);
}
- }
+ },
});
}
diff --git a/test/fixtures/language-transformer-test.js b/test/fixtures/language-transformer-test.js
index 1701b4f9..69cdc230 100644
--- a/test/fixtures/language-transformer-test.js
+++ b/test/fixtures/language-transformer-test.js
@@ -48,7 +48,7 @@ function hasTermReasons(languageTransformer, source, expectedTerm, expectedCondi
return {
has: true,
reasons: trace.map((frame) => frame.transform),
- rules: conditions
+ rules: conditions,
};
}
}
diff --git a/test/fixtures/translator-test.js b/test/fixtures/translator-test.js
index 9f1e87df..5c024472 100644
--- a/test/fixtures/translator-test.js
+++ b/test/fixtures/translator-test.js
@@ -49,7 +49,7 @@ export async function createTranslatorContext(dictionaryDirectory, dictionaryNam
const {errors} = await dictionaryImporter.importDictionary(
dictionaryDatabase,
testDictionaryData,
- {prefixWildcardsSupported: true}
+ {prefixWildcardsSupported: true},
);
expect(errors.length).toEqual(0);
@@ -75,7 +75,7 @@ export async function createTranslatorTest(htmlFilePath, dictionaryDirectory, di
const result = test.extend({
window: async ({window}, use) => { await use(window); },
// eslint-disable-next-line no-empty-pattern
- translator: async ({}, use) => { await use(translator); }
+ translator: async ({}, use) => { await use(translator); },
});
return result;
}
diff --git a/test/handlebars.test.js b/test/handlebars.test.js
index 8a566f4c..65e3d996 100644
--- a/test/handlebars.test.js
+++ b/test/handlebars.test.js
@@ -39,7 +39,7 @@ describe('Handlebars', () => {
const template = '{{~test1~}}';
const data = {
- test1: '<div style="font-size: 4em;">Test</div>'
+ test1: '<div style="font-size: 4em;">Test</div>',
};
const instance1 = compile(template);
@@ -56,8 +56,8 @@ describe('Handlebars', () => {
const data = {
test1: {
- test2: '<div style="font-size: 4em;">Test</div>'
- }
+ test2: '<div style="font-size: 4em;">Test</div>',
+ },
};
const instance1 = compile(template);
diff --git a/test/hotkey-util.test.js b/test/hotkey-util.test.js
index 6eb3f975..82a71a7c 100644
--- a/test/hotkey-util.test.js
+++ b/test/hotkey-util.test.js
@@ -37,7 +37,7 @@ describe('HotkeyUtil', () => {
{os: 'linux', command: 'Ctrl+Alt+Shift+F1', expectedCommand: 'Ctrl+Alt+Shift+F1', expectedInput: {key: 'F1', modifiers: ['ctrl', 'alt', 'shift']}},
{os: 'linux', command: 'MacCtrl+Alt+Shift+F1', expectedCommand: 'Ctrl+Alt+Shift+F1', expectedInput: {key: 'F1', modifiers: ['ctrl', 'alt', 'shift']}},
- {os: 'linux', command: 'Command+Alt+Shift+F1', expectedCommand: 'Command+Alt+Shift+F1', expectedInput: {key: 'F1', modifiers: ['meta', 'alt', 'shift']}}
+ {os: 'linux', command: 'Command+Alt+Shift+F1', expectedCommand: 'Command+Alt+Shift+F1', expectedInput: {key: 'F1', modifiers: ['meta', 'alt', 'shift']}},
];
/* eslint-enable @stylistic/no-multi-spaces */
@@ -131,7 +131,7 @@ describe('HotkeyUtil', () => {
{os: 'unknown', key: 'F1', modifiers: ['meta'], expected: 'Meta + F1'},
{os: 'unknown', key: null, modifiers: ['mouse1'], expected: 'Mouse 1'},
{os: 'unknown', key: 'KeyF', modifiers: ['mouse1'], expected: 'Mouse 1 + F'},
- {os: 'unknown', key: 'F1', modifiers: ['mouse1'], expected: 'Mouse 1 + F1'}
+ {os: 'unknown', key: 'F1', modifiers: ['mouse1'], expected: 'Mouse 1 + F1'},
];
/* eslint-enable @stylistic/no-multi-spaces */
@@ -148,7 +148,7 @@ describe('HotkeyUtil', () => {
/** @type {{modifiers: import('input').Modifier[], expected: import('input').Modifier[]}[]} */
const data = [
{modifiers: [], expected: []},
- {modifiers: ['shift', 'alt', 'ctrl', 'mouse4', 'meta', 'mouse1', 'mouse0'], expected: ['meta', 'ctrl', 'alt', 'shift', 'mouse0', 'mouse1', 'mouse4']}
+ {modifiers: ['shift', 'alt', 'ctrl', 'mouse4', 'meta', 'mouse1', 'mouse0'], expected: ['meta', 'ctrl', 'alt', 'shift', 'mouse0', 'mouse1', 'mouse4']},
];
const hotkeyUtil = new HotkeyUtil();
diff --git a/test/japanese-util.test.js b/test/japanese-util.test.js
index 63ac5cdf..22fad2f2 100644
--- a/test/japanese-util.test.js
+++ b/test/japanese-util.test.js
@@ -27,7 +27,7 @@ describe('Japanese utility functions', () => {
['力方', true],
['\u53f1\u{20b9f}', true],
['かたカタ々kata、。?,.?', false],
- ['逸逸', true]
+ ['逸逸', true],
];
test.each(data)('%s -> %o', (characters, expected) => {
@@ -44,7 +44,7 @@ describe('Japanese utility functions', () => {
const data = [
['かたカタ', true],
['力方々kata、。?,.?', false],
- ['\u53f1\u{20b9f}', false]
+ ['\u53f1\u{20b9f}', false],
];
test.each(data)('%s -> %o', (characters, expected) => {
@@ -62,7 +62,7 @@ describe('Japanese utility functions', () => {
['かたカタ力方々、。?', true],
['\u53f1\u{20b9f}', true],
['kata,.?', false],
- ['逸逸', true]
+ ['逸逸', true],
];
test.each(data)('%s -> %o', (characters, expected) => {
@@ -87,7 +87,7 @@ describe('Japanese utility functions', () => {
['kata,.?', false],
['かたカタ力方々、。?invalid', false],
['\u53f1\u{20b9f}invalid', false],
- ['kata,.?かた', false]
+ ['kata,.?かた', false],
];
test.each(data)('%s -> %o', (string, expected) => {
@@ -109,7 +109,7 @@ describe('Japanese utility functions', () => {
['かたカタ力方々、。?invalid', true],
['\u53f1\u{20b9f}invalid', true],
['kata,.?かた', true],
- ['逸逸', true]
+ ['逸逸', true],
];
test.each(data)('%s -> %o', (string, expected) => {
@@ -130,7 +130,7 @@ describe('Japanese utility functions', () => {
['katakana', 'katakana'],
['hiragana', 'hiragana'],
['カーナー', 'かあなあ'],
- ['カーナー', 'かーなー', true]
+ ['カーナー', 'かーなー', true],
];
for (const [string, expected, keepProlongedSoundMarks = false] of data) {
@@ -151,7 +151,7 @@ describe('Japanese utility functions', () => {
['ヒラガナひらがな', 'ヒラガナヒラガナ'],
['chikaraちからチカラ力', 'chikaraチカラチカラ力'],
['katakana', 'katakana'],
- ['hiragana', 'hiragana']
+ ['hiragana', 'hiragana'],
];
test.each(data)('%s -> %o', (string, expected) => {
@@ -170,7 +170,7 @@ describe('Japanese utility functions', () => {
['ヒラガナひらがな', 'hiraganahiragana'],
['chikaraちからチカラ力', 'chikarachikarachikara力'],
['katakana', 'katakana'],
- ['hiragana', 'hiragana']
+ ['hiragana', 'hiragana'],
];
test.each(data)('%s -> %o', (string, expected) => {
@@ -184,7 +184,7 @@ describe('Japanese utility functions', () => {
['0123456789', '0123456789'],
['abcdefghij', 'abcdefghij'],
['カタカナ', 'カタカナ'],
- ['ひらがな', 'ひらがな']
+ ['ひらがな', 'ひらがな'],
];
test.each(data)('%s -> %o', (string, expected) => {
@@ -202,7 +202,7 @@ describe('Japanese utility functions', () => {
['カキ', 'カキ'],
['ガキ', 'ガキ'],
['ニホン', 'ニホン'],
- ['ニッポン', 'ニッポン']
+ ['ニッポン', 'ニッポン'],
];
for (const [string, expected] of data) {
@@ -224,7 +224,7 @@ describe('Japanese utility functions', () => {
['カタカナ', 'カタカナ'],
['ひらがな', 'ひらがな'],
['chikara', 'ちから'],
- ['CHIKARA', 'ちから']
+ ['CHIKARA', 'ちから'],
];
for (const [string, expected] of data) {
@@ -246,37 +246,37 @@ describe('Japanese utility functions', () => {
{text: '有', reading: 'あ'},
{text: 'り', reading: ''},
{text: '難', reading: 'がと'},
- {text: 'う', reading: ''}
- ]
+ {text: 'う', reading: ''},
+ ],
],
[
['方々', 'かたがた'],
[
- {text: '方々', reading: 'かたがた'}
- ]
+ {text: '方々', reading: 'かたがた'},
+ ],
],
[
['お祝い', 'おいわい'],
[
{text: 'お', reading: ''},
{text: '祝', reading: 'いわ'},
- {text: 'い', reading: ''}
- ]
+ {text: 'い', reading: ''},
+ ],
],
[
['美味しい', 'おいしい'],
[
{text: '美味', reading: 'おい'},
- {text: 'しい', reading: ''}
- ]
+ {text: 'しい', reading: ''},
+ ],
],
[
['食べ物', 'たべもの'],
[
{text: '食', reading: 'た'},
{text: 'べ', reading: ''},
- {text: '物', reading: 'もの'}
- ]
+ {text: '物', reading: 'もの'},
+ ],
],
[
['試し切り', 'ためしぎり'],
@@ -284,53 +284,53 @@ describe('Japanese utility functions', () => {
{text: '試', reading: 'ため'},
{text: 'し', reading: ''},
{text: '切', reading: 'ぎ'},
- {text: 'り', reading: ''}
- ]
+ {text: 'り', reading: ''},
+ ],
],
// Ambiguous
[
['飼い犬', 'かいいぬ'],
[
- {text: '飼い犬', reading: 'かいいぬ'}
- ]
+ {text: '飼い犬', reading: 'かいいぬ'},
+ ],
],
[
['長い間', 'ながいあいだ'],
[
- {text: '長い間', reading: 'ながいあいだ'}
- ]
+ {text: '長い間', reading: 'ながいあいだ'},
+ ],
],
// Same/empty reading
[
['飼い犬', ''],
[
- {text: '飼い犬', reading: ''}
- ]
+ {text: '飼い犬', reading: ''},
+ ],
],
[
['かいいぬ', 'かいいぬ'],
[
- {text: 'かいいぬ', reading: ''}
- ]
+ {text: 'かいいぬ', reading: ''},
+ ],
],
[
['かいぬ', 'かいぬ'],
[
- {text: 'かいぬ', reading: ''}
- ]
+ {text: 'かいぬ', reading: ''},
+ ],
],
// Misc
[
['月', 'か'],
[
- {text: '月', reading: 'か'}
- ]
+ {text: '月', reading: 'か'},
+ ],
],
[
['月', 'カ'],
[
- {text: '月', reading: 'カ'}
- ]
+ {text: '月', reading: 'カ'},
+ ],
],
// Mismatched kana readings
[
@@ -339,125 +339,125 @@ describe('Japanese utility functions', () => {
{text: '有', reading: 'ア'},
{text: 'り', reading: 'リ'},
{text: '難', reading: 'ガト'},
- {text: 'う', reading: 'ウ'}
- ]
+ {text: 'う', reading: 'ウ'},
+ ],
],
[
['ありがとう', 'アリガトウ'],
[
- {text: 'ありがとう', reading: 'アリガトウ'}
- ]
+ {text: 'ありがとう', reading: 'アリガトウ'},
+ ],
],
// Mismatched kana readings (real examples)
[
['カ月', 'かげつ'],
[
{text: 'カ', reading: 'か'},
- {text: '月', reading: 'げつ'}
- ]
+ {text: '月', reading: 'げつ'},
+ ],
],
[
['序ノ口', 'じょのくち'],
[
{text: '序', reading: 'じょ'},
{text: 'ノ', reading: 'の'},
- {text: '口', reading: 'くち'}
- ]
+ {text: '口', reading: 'くち'},
+ ],
],
[
['スズメの涙', 'すずめのなみだ'],
[
{text: 'スズメ', reading: 'すずめ'},
{text: 'の', reading: ''},
- {text: '涙', reading: 'なみだ'}
- ]
+ {text: '涙', reading: 'なみだ'},
+ ],
],
[
['二カ所', 'にかしょ'],
[
{text: '二', reading: 'に'},
{text: 'カ', reading: 'か'},
- {text: '所', reading: 'しょ'}
- ]
+ {text: '所', reading: 'しょ'},
+ ],
],
[
['八ツ橋', 'やつはし'],
[
{text: '八', reading: 'や'},
{text: 'ツ', reading: 'つ'},
- {text: '橋', reading: 'はし'}
- ]
+ {text: '橋', reading: 'はし'},
+ ],
],
[
['八ツ橋', 'やつはし'],
[
{text: '八', reading: 'や'},
{text: 'ツ', reading: 'つ'},
- {text: '橋', reading: 'はし'}
- ]
+ {text: '橋', reading: 'はし'},
+ ],
],
[
['一カ月', 'いっかげつ'],
[
{text: '一', reading: 'いっ'},
{text: 'カ', reading: 'か'},
- {text: '月', reading: 'げつ'}
- ]
+ {text: '月', reading: 'げつ'},
+ ],
],
[
['一カ所', 'いっかしょ'],
[
{text: '一', reading: 'いっ'},
{text: 'カ', reading: 'か'},
- {text: '所', reading: 'しょ'}
- ]
+ {text: '所', reading: 'しょ'},
+ ],
],
[
['カ所', 'かしょ'],
[
{text: 'カ', reading: 'か'},
- {text: '所', reading: 'しょ'}
- ]
+ {text: '所', reading: 'しょ'},
+ ],
],
[
['数カ月', 'すうかげつ'],
[
{text: '数', reading: 'すう'},
{text: 'カ', reading: 'か'},
- {text: '月', reading: 'げつ'}
- ]
+ {text: '月', reading: 'げつ'},
+ ],
],
[
['くノ一', 'くのいち'],
[
{text: 'く', reading: ''},
{text: 'ノ', reading: 'の'},
- {text: '一', reading: 'いち'}
- ]
+ {text: '一', reading: 'いち'},
+ ],
],
[
['くノ一', 'くのいち'],
[
{text: 'く', reading: ''},
{text: 'ノ', reading: 'の'},
- {text: '一', reading: 'いち'}
- ]
+ {text: '一', reading: 'いち'},
+ ],
],
[
['数カ国', 'すうかこく'],
[
{text: '数', reading: 'すう'},
{text: 'カ', reading: 'か'},
- {text: '国', reading: 'こく'}
- ]
+ {text: '国', reading: 'こく'},
+ ],
],
[
['数カ所', 'すうかしょ'],
[
{text: '数', reading: 'すう'},
{text: 'カ', reading: 'か'},
- {text: '所', reading: 'しょ'}
- ]
+ {text: '所', reading: 'しょ'},
+ ],
],
[
['壇ノ浦の戦い', 'だんのうらのたたかい'],
@@ -467,8 +467,8 @@ describe('Japanese utility functions', () => {
{text: '浦', reading: 'うら'},
{text: 'の', reading: ''},
{text: '戦', reading: 'たたか'},
- {text: 'い', reading: ''}
- ]
+ {text: 'い', reading: ''},
+ ],
],
[
['壇ノ浦の戦', 'だんのうらのたたかい'],
@@ -477,38 +477,38 @@ describe('Japanese utility functions', () => {
{text: 'ノ', reading: 'の'},
{text: '浦', reading: 'うら'},
{text: 'の', reading: ''},
- {text: '戦', reading: 'たたかい'}
- ]
+ {text: '戦', reading: 'たたかい'},
+ ],
],
[
['序ノ口格', 'じょのくちかく'],
[
{text: '序', reading: 'じょ'},
{text: 'ノ', reading: 'の'},
- {text: '口格', reading: 'くちかく'}
- ]
+ {text: '口格', reading: 'くちかく'},
+ ],
],
[
['二カ国語', 'にかこくご'],
[
{text: '二', reading: 'に'},
{text: 'カ', reading: 'か'},
- {text: '国語', reading: 'こくご'}
- ]
+ {text: '国語', reading: 'こくご'},
+ ],
],
[
['カ国', 'かこく'],
[
{text: 'カ', reading: 'か'},
- {text: '国', reading: 'こく'}
- ]
+ {text: '国', reading: 'こく'},
+ ],
],
[
['カ国語', 'かこくご'],
[
{text: 'カ', reading: 'か'},
- {text: '国語', reading: 'こくご'}
- ]
+ {text: '国語', reading: 'こくご'},
+ ],
],
[
['壇ノ浦の合戦', 'だんのうらのかっせん'],
@@ -517,46 +517,46 @@ describe('Japanese utility functions', () => {
{text: 'ノ', reading: 'の'},
{text: '浦', reading: 'うら'},
{text: 'の', reading: ''},
- {text: '合戦', reading: 'かっせん'}
- ]
+ {text: '合戦', reading: 'かっせん'},
+ ],
],
[
['一タ偏', 'いちたへん'],
[
{text: '一', reading: 'いち'},
{text: 'タ', reading: 'た'},
- {text: '偏', reading: 'へん'}
- ]
+ {text: '偏', reading: 'へん'},
+ ],
],
[
['ル又', 'るまた'],
[
{text: 'ル', reading: 'る'},
- {text: '又', reading: 'また'}
- ]
+ {text: '又', reading: 'また'},
+ ],
],
[
['ノ木偏', 'のぎへん'],
[
{text: 'ノ', reading: 'の'},
- {text: '木偏', reading: 'ぎへん'}
- ]
+ {text: '木偏', reading: 'ぎへん'},
+ ],
],
[
['一ノ貝', 'いちのかい'],
[
{text: '一', reading: 'いち'},
{text: 'ノ', reading: 'の'},
- {text: '貝', reading: 'かい'}
- ]
+ {text: '貝', reading: 'かい'},
+ ],
],
[
['虎ノ門事件', 'とらのもんじけん'],
[
{text: '虎', reading: 'とら'},
{text: 'ノ', reading: 'の'},
- {text: '門事件', reading: 'もんじけん'}
- ]
+ {text: '門事件', reading: 'もんじけん'},
+ ],
],
[
['教育ニ関スル勅語', 'きょういくにかんするちょくご'],
@@ -565,96 +565,96 @@ describe('Japanese utility functions', () => {
{text: 'ニ', reading: 'に'},
{text: '関', reading: 'かん'},
{text: 'スル', reading: 'する'},
- {text: '勅語', reading: 'ちょくご'}
- ]
+ {text: '勅語', reading: 'ちょくご'},
+ ],
],
[
['二カ年', 'にかねん'],
[
{text: '二', reading: 'に'},
{text: 'カ', reading: 'か'},
- {text: '年', reading: 'ねん'}
- ]
+ {text: '年', reading: 'ねん'},
+ ],
],
[
['三カ年', 'さんかねん'],
[
{text: '三', reading: 'さん'},
{text: 'カ', reading: 'か'},
- {text: '年', reading: 'ねん'}
- ]
+ {text: '年', reading: 'ねん'},
+ ],
],
[
['四カ年', 'よんかねん'],
[
{text: '四', reading: 'よん'},
{text: 'カ', reading: 'か'},
- {text: '年', reading: 'ねん'}
- ]
+ {text: '年', reading: 'ねん'},
+ ],
],
[
['五カ年', 'ごかねん'],
[
{text: '五', reading: 'ご'},
{text: 'カ', reading: 'か'},
- {text: '年', reading: 'ねん'}
- ]
+ {text: '年', reading: 'ねん'},
+ ],
],
[
['六カ年', 'ろっかねん'],
[
{text: '六', reading: 'ろっ'},
{text: 'カ', reading: 'か'},
- {text: '年', reading: 'ねん'}
- ]
+ {text: '年', reading: 'ねん'},
+ ],
],
[
['七カ年', 'ななかねん'],
[
{text: '七', reading: 'なな'},
{text: 'カ', reading: 'か'},
- {text: '年', reading: 'ねん'}
- ]
+ {text: '年', reading: 'ねん'},
+ ],
],
[
['八カ年', 'はちかねん'],
[
{text: '八', reading: 'はち'},
{text: 'カ', reading: 'か'},
- {text: '年', reading: 'ねん'}
- ]
+ {text: '年', reading: 'ねん'},
+ ],
],
[
['九カ年', 'きゅうかねん'],
[
{text: '九', reading: 'きゅう'},
{text: 'カ', reading: 'か'},
- {text: '年', reading: 'ねん'}
- ]
+ {text: '年', reading: 'ねん'},
+ ],
],
[
['十カ年', 'じゅうかねん'],
[
{text: '十', reading: 'じゅう'},
{text: 'カ', reading: 'か'},
- {text: '年', reading: 'ねん'}
- ]
+ {text: '年', reading: 'ねん'},
+ ],
],
[
['鏡ノ間', 'かがみのま'],
[
{text: '鏡', reading: 'かがみ'},
{text: 'ノ', reading: 'の'},
- {text: '間', reading: 'ま'}
- ]
+ {text: '間', reading: 'ま'},
+ ],
],
[
['鏡ノ間', 'かがみのま'],
[
{text: '鏡', reading: 'かがみ'},
{text: 'ノ', reading: 'の'},
- {text: '間', reading: 'ま'}
- ]
+ {text: '間', reading: 'ま'},
+ ],
],
[
['ページ違反', 'ぺーじいはん'],
@@ -662,39 +662,39 @@ describe('Japanese utility functions', () => {
{text: 'ペ', reading: 'ぺ'},
{text: 'ー', reading: ''},
{text: 'ジ', reading: 'じ'},
- {text: '違反', reading: 'いはん'}
- ]
+ {text: '違反', reading: 'いはん'},
+ ],
],
// Mismatched kana
[
['サボる', 'サボル'],
[
{text: 'サボ', reading: ''},
- {text: 'る', reading: 'ル'}
- ]
+ {text: 'る', reading: 'ル'},
+ ],
],
// Reading starts with term, but has remainder characters
[
['シック', 'シック・ビルしょうこうぐん'],
[
- {text: 'シック', reading: 'シック・ビルしょうこうぐん'}
- ]
+ {text: 'シック', reading: 'シック・ビルしょうこうぐん'},
+ ],
],
// Kanji distribution tests
[
['逸らす', 'そらす'],
[
{text: '逸', reading: 'そ'},
- {text: 'らす', reading: ''}
- ]
+ {text: 'らす', reading: ''},
+ ],
],
[
['逸らす', 'そらす'],
[
{text: '逸', reading: 'そ'},
- {text: 'らす', reading: ''}
- ]
- ]
+ {text: 'らす', reading: ''},
+ ],
+ ],
];
test.each(data)('%o -> %o', (input, expected) => {
@@ -711,41 +711,41 @@ describe('Japanese utility functions', () => {
['美味しい', 'おいしい', '美味しかた'],
[
{text: '美味', reading: 'おい'},
- {text: 'しかた', reading: ''}
- ]
+ {text: 'しかた', reading: ''},
+ ],
],
[
['食べる', 'たべる', '食べた'],
[
{text: '食', reading: 'た'},
- {text: 'べた', reading: ''}
- ]
+ {text: 'べた', reading: ''},
+ ],
],
[
['迄に', 'までに', 'までに'],
[
- {text: 'までに', reading: ''}
- ]
+ {text: 'までに', reading: ''},
+ ],
],
[
['行う', 'おこなう', 'おこなわなかった'],
[
- {text: 'おこなわなかった', reading: ''}
- ]
+ {text: 'おこなわなかった', reading: ''},
+ ],
],
[
['いい', 'いい', 'イイ'],
[
- {text: 'イイ', reading: ''}
- ]
+ {text: 'イイ', reading: ''},
+ ],
],
[
['否か', 'いなか', '否カ'],
[
{text: '否', reading: 'いな'},
- {text: 'カ', reading: 'か'}
- ]
- ]
+ {text: 'カ', reading: 'か'},
+ ],
+ ],
];
test.each(data)('%o -> %o', (input, expected) => {
@@ -794,7 +794,7 @@ describe('Japanese utility functions', () => {
[['っっ', false], 'っ'],
[['っっ', true], ''],
[['っっっ', false], 'っ'],
- [['っっっ', true], '']
+ [['っっっ', true], ''],
];
test.each(data)('%o -> %o', (input, output) => {
@@ -833,7 +833,7 @@ describe('Japanese utility functions', () => {
[[0, 4], false],
[[1, 4], true],
[[2, 4], true],
- [[3, 4], true]
+ [[3, 4], true],
];
test.each(data)('%o -> %o', (input, expected) => {
@@ -854,7 +854,7 @@ describe('Japanese utility functions', () => {
['ちゃんと', ['ちゃ', 'ん', 'と']],
['とうきょう', ['と', 'う', 'きょ', 'う']],
['ぎゅう', ['ぎゅ', 'う']],
- ['ディスコ', ['ディ', 'ス', 'コ']]
+ ['ディスコ', ['ディ', 'ス', 'コ']],
];
test.each(data)('%s -> %o', (text, expected) => {
diff --git a/test/json-schema.test.js b/test/json-schema.test.js
index dba14c54..0b17e7ce 100644
--- a/test/json-schema.test.js
+++ b/test/json-schema.test.js
@@ -53,28 +53,28 @@ describe('JsonSchema', () => {
const schema = {
allOf: [
{
- type: 'number'
+ type: 'number',
},
{
anyOf: [
{minimum: 10, maximum: 100},
- {minimum: -100, maximum: -10}
- ]
+ {minimum: -100, maximum: -10},
+ ],
},
{
oneOf: [
{multipleOf: 3},
- {multipleOf: 5}
- ]
+ {multipleOf: 5},
+ ],
},
{
not: {
anyOf: [
- {multipleOf: 20}
- ]
- }
- }
- ]
+ {multipleOf: 20},
+ ],
+ },
+ },
+ ],
};
/**
@@ -115,7 +115,7 @@ describe('JsonSchema', () => {
// String tests
{
schema: {
- type: 'string'
+ type: 'string',
},
inputs: [
{expected: false, value: null},
@@ -123,97 +123,97 @@ describe('JsonSchema', () => {
{expected: false, value: 0},
{expected: false, value: {}},
{expected: false, value: []},
- {expected: true, value: ''}
- ]
+ {expected: true, value: ''},
+ ],
},
{
schema: {
type: 'string',
- minLength: 2
+ minLength: 2,
},
inputs: [
{expected: false, value: ''},
{expected: false, value: '1'},
{expected: true, value: '12'},
- {expected: true, value: '123'}
- ]
+ {expected: true, value: '123'},
+ ],
},
{
schema: {
type: 'string',
- maxLength: 2
+ maxLength: 2,
},
inputs: [
{expected: true, value: ''},
{expected: true, value: '1'},
{expected: true, value: '12'},
- {expected: false, value: '123'}
- ]
+ {expected: false, value: '123'},
+ ],
},
{
schema: {
type: 'string',
- pattern: 'test'
+ pattern: 'test',
},
inputs: [
{expected: false, value: ''},
{expected: true, value: 'test'},
{expected: false, value: 'TEST'},
{expected: true, value: 'ABCtestDEF'},
- {expected: false, value: 'ABCTESTDEF'}
- ]
+ {expected: false, value: 'ABCTESTDEF'},
+ ],
},
{
schema: {
type: 'string',
- pattern: '^test$'
+ pattern: '^test$',
},
inputs: [
{expected: false, value: ''},
{expected: true, value: 'test'},
{expected: false, value: 'TEST'},
{expected: false, value: 'ABCtestDEF'},
- {expected: false, value: 'ABCTESTDEF'}
- ]
+ {expected: false, value: 'ABCTESTDEF'},
+ ],
},
{
schema: {
type: 'string',
pattern: '^test$',
- patternFlags: 'i'
+ patternFlags: 'i',
},
inputs: [
{expected: false, value: ''},
{expected: true, value: 'test'},
{expected: true, value: 'TEST'},
{expected: false, value: 'ABCtestDEF'},
- {expected: false, value: 'ABCTESTDEF'}
- ]
+ {expected: false, value: 'ABCTESTDEF'},
+ ],
},
{
schema: {
type: 'string',
- pattern: '*'
+ pattern: '*',
},
inputs: [
- {expected: false, value: ''}
- ]
+ {expected: false, value: ''},
+ ],
},
{
schema: {
type: 'string',
pattern: '.',
- patternFlags: '?'
+ patternFlags: '?',
},
inputs: [
- {expected: false, value: ''}
- ]
+ {expected: false, value: ''},
+ ],
},
// Const tests
{
schema: {
- const: 32
+ const: 32,
},
inputs: [
{expected: true, value: 32},
@@ -221,12 +221,12 @@ describe('JsonSchema', () => {
{expected: false, value: '32'},
{expected: false, value: null},
{expected: false, value: {a: 'b'}},
- {expected: false, value: [1, 2, 3]}
- ]
+ {expected: false, value: [1, 2, 3]},
+ ],
},
{
schema: {
- const: '32'
+ const: '32',
},
inputs: [
{expected: false, value: 32},
@@ -234,12 +234,12 @@ describe('JsonSchema', () => {
{expected: true, value: '32'},
{expected: false, value: null},
{expected: false, value: {a: 'b'}},
- {expected: false, value: [1, 2, 3]}
- ]
+ {expected: false, value: [1, 2, 3]},
+ ],
},
{
schema: {
- const: null
+ const: null,
},
inputs: [
{expected: false, value: 32},
@@ -247,12 +247,12 @@ describe('JsonSchema', () => {
{expected: false, value: '32'},
{expected: true, value: null},
{expected: false, value: {a: 'b'}},
- {expected: false, value: [1, 2, 3]}
- ]
+ {expected: false, value: [1, 2, 3]},
+ ],
},
{
schema: {
- const: {a: 'b'}
+ const: {a: 'b'},
},
inputs: [
{expected: false, value: 32},
@@ -260,12 +260,12 @@ describe('JsonSchema', () => {
{expected: false, value: '32'},
{expected: false, value: null},
{expected: false, value: {a: 'b'}},
- {expected: false, value: [1, 2, 3]}
- ]
+ {expected: false, value: [1, 2, 3]},
+ ],
},
{
schema: {
- const: [1, 2, 3]
+ const: [1, 2, 3],
},
inputs: [
{expected: false, value: 32},
@@ -273,15 +273,15 @@ describe('JsonSchema', () => {
{expected: false, value: '32'},
{expected: false, value: null},
{expected: false, value: {a: 'b'}},
- {expected: false, value: [1, 2, 3]}
- ]
+ {expected: false, value: [1, 2, 3]},
+ ],
},
// Array contains tests
{
schema: {
type: 'array',
- contains: {const: 32}
+ contains: {const: 32},
},
inputs: [
{expected: false, value: []},
@@ -290,119 +290,119 @@ describe('JsonSchema', () => {
{expected: true, value: [1, 32, 1]},
{expected: false, value: [33]},
{expected: false, value: [1, 33]},
- {expected: false, value: [1, 33, 1]}
- ]
+ {expected: false, value: [1, 33, 1]},
+ ],
},
// Number limits tests
{
schema: {
type: 'number',
- minimum: 0
+ minimum: 0,
},
inputs: [
{expected: false, value: -1},
{expected: true, value: 0},
- {expected: true, value: 1}
- ]
+ {expected: true, value: 1},
+ ],
},
{
schema: {
type: 'number',
- exclusiveMinimum: 0
+ exclusiveMinimum: 0,
},
inputs: [
{expected: false, value: -1},
{expected: false, value: 0},
- {expected: true, value: 1}
- ]
+ {expected: true, value: 1},
+ ],
},
{
schema: {
type: 'number',
- maximum: 0
+ maximum: 0,
},
inputs: [
{expected: true, value: -1},
{expected: true, value: 0},
- {expected: false, value: 1}
- ]
+ {expected: false, value: 1},
+ ],
},
{
schema: {
type: 'number',
- exclusiveMaximum: 0
+ exclusiveMaximum: 0,
},
inputs: [
{expected: true, value: -1},
{expected: false, value: 0},
- {expected: false, value: 1}
- ]
+ {expected: false, value: 1},
+ ],
},
// Integer limits tests
{
schema: {
type: 'integer',
- minimum: 0
+ minimum: 0,
},
inputs: [
{expected: false, value: -1},
{expected: true, value: 0},
- {expected: true, value: 1}
- ]
+ {expected: true, value: 1},
+ ],
},
{
schema: {
type: 'integer',
- exclusiveMinimum: 0
+ exclusiveMinimum: 0,
},
inputs: [
{expected: false, value: -1},
{expected: false, value: 0},
- {expected: true, value: 1}
- ]
+ {expected: true, value: 1},
+ ],
},
{
schema: {
type: 'integer',
- maximum: 0
+ maximum: 0,
},
inputs: [
{expected: true, value: -1},
{expected: true, value: 0},
- {expected: false, value: 1}
- ]
+ {expected: false, value: 1},
+ ],
},
{
schema: {
type: 'integer',
- exclusiveMaximum: 0
+ exclusiveMaximum: 0,
},
inputs: [
{expected: true, value: -1},
{expected: false, value: 0},
- {expected: false, value: 1}
- ]
+ {expected: false, value: 1},
+ ],
},
{
schema: {
type: 'integer',
- multipleOf: 2
+ multipleOf: 2,
},
inputs: [
{expected: true, value: -2},
{expected: false, value: -1},
{expected: true, value: 0},
{expected: false, value: 1},
- {expected: true, value: 2}
- ]
+ {expected: true, value: 2},
+ ],
},
// Numeric type tests
{
schema: {
- type: 'number'
+ type: 'number',
},
inputs: [
{expected: true, value: 0},
@@ -411,12 +411,12 @@ describe('JsonSchema', () => {
{expected: false, value: '0'},
{expected: false, value: null},
{expected: false, value: []},
- {expected: false, value: {}}
- ]
+ {expected: false, value: {}},
+ ],
},
{
schema: {
- type: 'integer'
+ type: 'integer',
},
inputs: [
{expected: true, value: 0},
@@ -425,8 +425,8 @@ describe('JsonSchema', () => {
{expected: false, value: '0'},
{expected: false, value: null},
{expected: false, value: []},
- {expected: false, value: {}}
- ]
+ {expected: false, value: {}},
+ ],
},
// Reference tests
@@ -434,10 +434,10 @@ describe('JsonSchema', () => {
schema: {
definitions: {
example: {
- type: 'number'
- }
+ type: 'number',
+ },
},
- $ref: '#/definitions/example'
+ $ref: '#/definitions/example',
},
inputs: [
{expected: true, value: 0},
@@ -446,17 +446,17 @@ describe('JsonSchema', () => {
{expected: false, value: '0'},
{expected: false, value: null},
{expected: false, value: []},
- {expected: false, value: {}}
- ]
+ {expected: false, value: {}},
+ ],
},
{
schema: {
definitions: {
example: {
- type: 'integer'
- }
+ type: 'integer',
+ },
},
- $ref: '#/definitions/example'
+ $ref: '#/definitions/example',
},
inputs: [
{expected: true, value: 0},
@@ -465,8 +465,8 @@ describe('JsonSchema', () => {
{expected: false, value: '0'},
{expected: false, value: null},
{expected: false, value: []},
- {expected: false, value: {}}
- ]
+ {expected: false, value: {}},
+ ],
},
{
schema: {
@@ -476,12 +476,12 @@ describe('JsonSchema', () => {
additionalProperties: false,
properties: {
test: {
- $ref: '#/definitions/example'
- }
- }
- }
+ $ref: '#/definitions/example',
+ },
+ },
+ },
},
- $ref: '#/definitions/example'
+ $ref: '#/definitions/example',
},
inputs: [
{expected: false, value: 0},
@@ -499,9 +499,9 @@ describe('JsonSchema', () => {
{expected: false, value: {test: []}},
{expected: true, value: {test: {}}},
{expected: true, value: {test: {test: {}}}},
- {expected: true, value: {test: {test: {test: {}}}}}
- ]
- }
+ {expected: true, value: {test: {test: {test: {}}}}},
+ ],
+ },
];
/* eslint-enable @stylistic/no-multi-spaces */
@@ -524,49 +524,49 @@ describe('JsonSchema', () => {
properties: {
test: {
type: 'string',
- default: 'default'
- }
+ default: 'default',
+ },
},
- additionalProperties: false
+ additionalProperties: false,
},
inputs: [
[
void 0,
- {test: 'default'}
+ {test: 'default'},
],
[
null,
- {test: 'default'}
+ {test: 'default'},
],
[
0,
- {test: 'default'}
+ {test: 'default'},
],
[
'',
- {test: 'default'}
+ {test: 'default'},
],
[
[],
- {test: 'default'}
+ {test: 'default'},
],
[
{},
- {test: 'default'}
+ {test: 'default'},
],
[
{test: 'value'},
- {test: 'value'}
+ {test: 'value'},
],
[
{test2: 'value2'},
- {test: 'default'}
+ {test: 'default'},
],
[
{test: 'value', test2: 'value2'},
- {test: 'value'}
- ]
- ]
+ {test: 'value'},
+ ],
+ ],
},
// Test value defaulting on objects with additionalProperties=true
@@ -577,29 +577,29 @@ describe('JsonSchema', () => {
properties: {
test: {
type: 'string',
- default: 'default'
- }
+ default: 'default',
+ },
},
- additionalProperties: true
+ additionalProperties: true,
},
inputs: [
[
{},
- {test: 'default'}
+ {test: 'default'},
],
[
{test: 'value'},
- {test: 'value'}
+ {test: 'value'},
],
[
{test2: 'value2'},
- {test: 'default', test2: 'value2'}
+ {test: 'default', test2: 'value2'},
],
[
{test: 'value', test2: 'value2'},
- {test: 'value', test2: 'value2'}
- ]
- ]
+ {test: 'value', test2: 'value2'},
+ ],
+ ],
},
// Test value defaulting on objects with additionalProperties={schema}
@@ -610,48 +610,48 @@ describe('JsonSchema', () => {
properties: {
test: {
type: 'string',
- default: 'default'
- }
+ default: 'default',
+ },
},
additionalProperties: {
type: 'number',
- default: 10
- }
+ default: 10,
+ },
},
inputs: [
[
{},
- {test: 'default'}
+ {test: 'default'},
],
[
{test: 'value'},
- {test: 'value'}
+ {test: 'value'},
],
[
{test2: 'value2'},
- {test: 'default', test2: 10}
+ {test: 'default', test2: 10},
],
[
{test: 'value', test2: 'value2'},
- {test: 'value', test2: 10}
+ {test: 'value', test2: 10},
],
[
{test2: 2},
- {test: 'default', test2: 2}
+ {test: 'default', test2: 2},
],
[
{test: 'value', test2: 2},
- {test: 'value', test2: 2}
+ {test: 'value', test2: 2},
],
[
{test: 'value', test2: 2, test3: null},
- {test: 'value', test2: 2, test3: 10}
+ {test: 'value', test2: 2, test3: 10},
],
[
{test: 'value', test2: 2, test3: void 0},
- {test: 'value', test2: 2, test3: 10}
- ]
- ]
+ {test: 'value', test2: 2, test3: 10},
+ ],
+ ],
},
// Test value defaulting where hasOwnProperty is false
@@ -662,24 +662,24 @@ describe('JsonSchema', () => {
properties: {
test: {
type: 'string',
- default: 'default'
- }
- }
+ default: 'default',
+ },
+ },
},
inputs: [
[
{},
- {test: 'default'}
+ {test: 'default'},
],
[
{test: 'value'},
- {test: 'value'}
+ {test: 'value'},
],
[
Object.create({test: 'value'}),
- {test: 'default'}
- ]
- ]
+ {test: 'default'},
+ ],
+ ],
},
{
schema: {
@@ -688,24 +688,24 @@ describe('JsonSchema', () => {
properties: {
toString: /** @type {import('ext/json-schema').SchemaObject} */ ({
type: 'string',
- default: 'default'
- })
- }
+ default: 'default',
+ }),
+ },
},
inputs: [
[
{},
- {toString: 'default'}
+ {toString: 'default'},
],
[
{toString: 'value'},
- {toString: 'value'}
+ {toString: 'value'},
],
[
Object.create({toString: 'value'}),
- {toString: 'default'}
- ]
- ]
+ {toString: 'default'},
+ ],
+ ],
},
// Test enum
@@ -717,28 +717,28 @@ describe('JsonSchema', () => {
test: {
type: 'string',
default: 'value1',
- enum: ['value1', 'value2', 'value3']
- }
- }
+ enum: ['value1', 'value2', 'value3'],
+ },
+ },
},
inputs: [
[
{test: 'value1'},
- {test: 'value1'}
+ {test: 'value1'},
],
[
{test: 'value2'},
- {test: 'value2'}
+ {test: 'value2'},
],
[
{test: 'value3'},
- {test: 'value3'}
+ {test: 'value3'},
],
[
{test: 'value4'},
- {test: 'value1'}
- ]
- ]
+ {test: 'value1'},
+ ],
+ ],
},
// Test valid vs invalid default
@@ -750,16 +750,16 @@ describe('JsonSchema', () => {
test: {
type: 'integer',
default: 2,
- minimum: 1
- }
- }
+ minimum: 1,
+ },
+ },
},
inputs: [
[
{test: -1},
- {test: 2}
- ]
- ]
+ {test: 2},
+ ],
+ ],
},
{
schema: {
@@ -769,16 +769,16 @@ describe('JsonSchema', () => {
test: {
type: 'integer',
default: 1,
- minimum: 2
- }
- }
+ minimum: 2,
+ },
+ },
},
inputs: [
[
{test: -1},
- {test: -1}
- ]
- ]
+ {test: -1},
+ ],
+ ],
},
// Test references
@@ -787,29 +787,29 @@ describe('JsonSchema', () => {
definitions: {
example: {
type: 'number',
- default: 0
- }
+ default: 0,
+ },
},
- $ref: '#/definitions/example'
+ $ref: '#/definitions/example',
},
inputs: [
[
1,
- 1
+ 1,
],
[
null,
- 0
+ 0,
],
[
'test',
- 0
+ 0,
],
[
{test: 'value'},
- 0
- ]
- ]
+ 0,
+ ],
+ ],
},
{
schema: {
@@ -819,44 +819,44 @@ describe('JsonSchema', () => {
additionalProperties: false,
properties: {
test: {
- $ref: '#/definitions/example'
- }
- }
- }
+ $ref: '#/definitions/example',
+ },
+ },
+ },
},
- $ref: '#/definitions/example'
+ $ref: '#/definitions/example',
},
inputs: [
[
1,
- {}
+ {},
],
[
null,
- {}
+ {},
],
[
'test',
- {}
+ {},
],
[
{},
- {}
+ {},
],
[
{test: {}},
- {test: {}}
+ {test: {}},
],
[
{test: 'value'},
- {test: {}}
+ {test: {}},
],
[
{test: {test: {}}},
- {test: {test: {}}}
- ]
- ]
- }
+ {test: {test: {}}},
+ ],
+ ],
+ },
];
describe.each(data)('Schema %#', ({schema, inputs}) => {
@@ -880,17 +880,17 @@ describe('JsonSchema', () => {
properties: {
test: {
type: 'string',
- default: 'default'
- }
- }
+ default: 'default',
+ },
+ },
},
tests: [
{error: false, value: {test: 'default'}, action: (value) => { value.test = 'string'; }},
{error: true, value: {test: 'default'}, action: (value) => { value.test = null; }},
{error: true, value: {test: 'default'}, action: (value) => { delete value.test; }},
{error: true, value: {test: 'default'}, action: (value) => { value.test2 = 'string'; }},
- {error: false, value: {test: 'default'}, action: (value) => { delete value.test2; }}
- ]
+ {error: false, value: {test: 'default'}, action: (value) => { delete value.test2; }},
+ ],
},
{
schema: {
@@ -900,17 +900,17 @@ describe('JsonSchema', () => {
properties: {
test: {
type: 'string',
- default: 'default'
- }
- }
+ default: 'default',
+ },
+ },
},
tests: [
{error: false, value: {test: 'default'}, action: (value) => { value.test = 'string'; }},
{error: true, value: {test: 'default'}, action: (value) => { value.test = null; }},
{error: true, value: {test: 'default'}, action: (value) => { delete value.test; }},
{error: false, value: {test: 'default'}, action: (value) => { value.test2 = 'string'; }},
- {error: false, value: {test: 'default'}, action: (value) => { delete value.test2; }}
- ]
+ {error: false, value: {test: 'default'}, action: (value) => { delete value.test2; }},
+ ],
},
{
schema: {
@@ -930,13 +930,13 @@ describe('JsonSchema', () => {
properties: {
test3: {
type: 'string',
- default: 'default'
- }
- }
- }
- }
- }
- }
+ default: 'default',
+ },
+ },
+ },
+ },
+ },
+ },
},
tests: [
{error: false, action: (value) => { value.test1.test2.test3 = 'string'; }},
@@ -945,8 +945,8 @@ describe('JsonSchema', () => {
{error: true, action: (value) => { value.test1.test2 = null; }},
{error: true, action: (value) => { value.test1 = null; }},
{error: true, action: (value) => { value.test4 = 'string'; }},
- {error: false, action: (value) => { delete value.test4; }}
- ]
+ {error: false, action: (value) => { delete value.test4; }},
+ ],
},
// Array tests
@@ -955,8 +955,8 @@ describe('JsonSchema', () => {
type: 'array',
items: {
type: 'string',
- default: 'default'
- }
+ default: 'default',
+ },
},
tests: [
{error: false, value: ['default'], action: (value) => { value[0] = 'string'; }},
@@ -970,9 +970,9 @@ describe('JsonSchema', () => {
value[1] = 'string';
if (value.length !== 2) { throw new Error(`Invalid length; expected=2; actual=${value.length}`); }
if (typeof value.push !== 'function') { throw new Error(`Invalid push; expected=function; actual=${typeof value.push}`); }
- }
- }
- ]
+ },
+ },
+ ],
},
// Reference tests
@@ -984,12 +984,12 @@ describe('JsonSchema', () => {
additionalProperties: false,
properties: {
test: {
- $ref: '#/definitions/example'
- }
- }
- }
+ $ref: '#/definitions/example',
+ },
+ },
+ },
},
- $ref: '#/definitions/example'
+ $ref: '#/definitions/example',
},
tests: [
{error: false, value: {}, action: (value) => { value.test = {}; }},
@@ -998,9 +998,9 @@ describe('JsonSchema', () => {
{error: true, value: {}, action: (value) => { value.test = null; }},
{error: true, value: {}, action: (value) => { value.test = 'string'; }},
{error: true, value: {}, action: (value) => { value.test = {}; value.test.test = 'string'; }},
- {error: true, value: {}, action: (value) => { value.test = {test: 'string'}; }}
- ]
- }
+ {error: true, value: {}, action: (value) => { value.test = {test: 'string'}; }},
+ ],
+ },
];
/* eslint-enable @stylistic/no-multi-spaces */
diff --git a/test/json.test.js b/test/json.test.js
index aa12dc09..885c4695 100644
--- a/test/json.test.js
+++ b/test/json.test.js
@@ -49,7 +49,7 @@ function createAjv() {
return new Ajv({
meta: true,
strictTuples: false,
- allowUnionTypes: true
+ allowUnionTypes: true,
});
}
@@ -69,7 +69,7 @@ function createValidatorFunctionFromTypeScript(path, type, jsconfigType) {
additionalProperties: false,
minify: false,
expose: 'none',
- strictTuples: true
+ strictTuples: true,
};
const schema = createGenerator(config).createSchema(config.type);
const ajv = createAjv();
@@ -105,7 +105,7 @@ describe.concurrent('JSON validation', () => {
'playwright',
'test-results',
'dev/lib',
- 'test/playwright'
+ 'test/playwright',
]);
const existingJsonFiles = getAllFiles(rootDir, (path, isDirectory) => {
diff --git a/test/language-transformer-cycles.test.js b/test/language-transformer-cycles.test.js
index ab14eaa4..2a5cba6c 100644
--- a/test/language-transformer-cycles.test.js
+++ b/test/language-transformer-cycles.test.js
@@ -133,7 +133,7 @@ describe.each(languagesWithTransforms)('Cycles Test $iso', ({languageTransforms}
if (
!LanguageTransformer.conditionsMatch(
languageTransformer.getConditionFlagsFromConditionTypes(ruleNames),
- languageTransformer.getConditionFlagsFromConditionTypes(conditionsIn)
+ languageTransformer.getConditionFlagsFromConditionTypes(conditionsIn),
) ||
!text.endsWith(suffixIn) ||
(text.length - suffixIn.length + suffixOut.length) <= 0
@@ -145,7 +145,7 @@ describe.each(languagesWithTransforms)('Cycles Test $iso', ({languageTransforms}
text.substring(0, text.length - suffixIn.length) + suffixOut,
conditionsOut,
ruleNode,
- deinflectionNode
+ deinflectionNode,
);
// Cycle check
diff --git a/test/language/albanian-transforms.test.js b/test/language/albanian-transforms.test.js
index f99307c4..24fa5cde 100644
--- a/test/language/albanian-transforms.test.js
+++ b/test/language/albanian-transforms.test.js
@@ -124,8 +124,8 @@ const tests = [
{term: 'kujtohem', source: 'kujtohuni', rule: 'v', reasons: ['imperative second-person plural present']},
{term: 'kthej', source: 'kthye', rule: 'v', reasons: ['aorist third-person singular indicative']},
- {term: 'shkëlqej', source: 'shkëlqyer', rule: 'v', reasons: ['participle']}
- ]
+ {term: 'shkëlqej', source: 'shkëlqyer', rule: 'v', reasons: ['participle']},
+ ],
},
{
category: 'nouns',
@@ -136,9 +136,9 @@ const tests = [
{term: 'gëzoj', source: 'gëzim', rule: 'v', reasons: ['nominalization']},
{term: 'zbuloj', source: 'zbulim', rule: 'v', reasons: ['nominalization']},
{term: 'përkthej', source: 'përkthim', rule: 'v', reasons: ['nominalization']},
- {term: 'lëviz', source: 'lëvizje', rule: 'v', reasons: ['nominalization']}
- ]
- }
+ {term: 'lëviz', source: 'lëvizje', rule: 'v', reasons: ['nominalization']},
+ ],
+ },
];
/* eslint-enable @stylistic/no-multi-spaces */
diff --git a/test/language/english-transforms.test.js b/test/language/english-transforms.test.js
index 9ae48ce1..9109f679 100644
--- a/test/language/english-transforms.test.js
+++ b/test/language/english-transforms.test.js
@@ -37,8 +37,8 @@ const tests = [
{term: 'slip', source: 'slippy', rule: 'ns', reasons: ['-y']},
{term: 'star', source: 'starry', rule: 'ns', reasons: ['-y']},
{term: 'gas', source: 'gassy', rule: 'ns', reasons: ['-y']},
- {term: 'wit', source: 'witty', rule: 'ns', reasons: ['-y']}
- ]
+ {term: 'wit', source: 'witty', rule: 'ns', reasons: ['-y']},
+ ],
},
{
category: 'verbs',
@@ -95,8 +95,8 @@ const tests = [
{term: 'slip', source: 'slippy', rule: 'v', reasons: ['-y']},
{term: 'blur', source: 'blurry', rule: 'v', reasons: ['-y']},
{term: 'chat', source: 'chatty', rule: 'v', reasons: ['-y']},
- {term: 'learn', source: 'unlearn', rule: 'v', reasons: ['un-']}
- ]
+ {term: 'learn', source: 'unlearn', rule: 'v', reasons: ['un-']},
+ ],
},
{
category: 'phrasal verbs',
@@ -106,15 +106,15 @@ const tests = [
{term: 'look up', source: 'looking up', rule: 'v_phr', reasons: ['ing']},
{term: 'look up', source: 'looked up', rule: 'v_phr', reasons: ['past']},
{term: 'look up', source: 'looks up', rule: 'v_phr', reasons: ['3rd pers. sing. pres']},
- {term: 'look up', source: 'looked something up', rule: 'v_phr', reasons: ['past', 'interposed object']}
- ]
+ {term: 'look up', source: 'looked something up', rule: 'v_phr', reasons: ['past', 'interposed object']},
+ ],
},
{
category: 'adverbs',
valid: true,
tests: [
- {term: 'interestingly', source: 'uninterestingly', rule: 'adj', reasons: ['un-']}
- ]
+ {term: 'interestingly', source: 'uninterestingly', rule: 'adj', reasons: ['un-']},
+ ],
},
{
category: 'adjectives',
@@ -141,9 +141,9 @@ const tests = [
{term: 'hot', source: 'hottest', rule: 'adj', reasons: ['superlative']},
{term: 'quick', source: 'quickly', rule: 'adj', reasons: ['adverb']},
{term: 'happy', source: 'happily', rule: 'adj', reasons: ['adverb']},
- {term: 'humble', source: 'humbly', rule: 'adj', reasons: ['adverb']}
- ]
- }
+ {term: 'humble', source: 'humbly', rule: 'adj', reasons: ['adverb']},
+ ],
+ },
];
/* eslint-enable @stylistic/no-multi-spaces */
diff --git a/test/language/japanese-transforms.test.js b/test/language/japanese-transforms.test.js
index c1fdb865..64d935d5 100644
--- a/test/language/japanese-transforms.test.js
+++ b/test/language/japanese-transforms.test.js
@@ -41,8 +41,8 @@ const tests = [
{term: '愛しい', source: '愛しき', rule: 'adj-i', reasons: ['-ki']},
{term: '愛しい', source: '愛しげ', rule: 'adj-i', reasons: ['-ge']},
{term: '愛しい', source: '愛し気', rule: 'adj-i', reasons: ['-ge']},
- {term: '愛しい', source: '愛しがる', rule: 'adj-i', reasons: ['-garu']}
- ]
+ {term: '愛しい', source: '愛しがる', rule: 'adj-i', reasons: ['-garu']},
+ ],
},
{
category: 'ichidan verbs',
@@ -96,8 +96,8 @@ const tests = [
{term: '食べる', source: '食べておる', rule: 'v1', reasons: ['-te', 'progressive or perfect']},
{term: '食べる', source: '食べてる', rule: 'v1', reasons: ['-te', 'progressive or perfect']},
{term: '食べる', source: '食べとる', rule: 'v1', reasons: ['-te', 'progressive or perfect']},
- {term: '食べる', source: '食べてしまう', rule: 'v1', reasons: ['-te', '-shimau']}
- ]
+ {term: '食べる', source: '食べてしまう', rule: 'v1', reasons: ['-te', '-shimau']},
+ ],
},
{
category: '-u verbs',
@@ -151,8 +151,8 @@ const tests = [
{term: '買う', source: '買っておる', rule: 'v5', reasons: ['-te', 'progressive or perfect']},
{term: '買う', source: '買ってる', rule: 'v5', reasons: ['-te', 'progressive or perfect']},
{term: '買う', source: '買っとる', rule: 'v5', reasons: ['-te', 'progressive or perfect']},
- {term: '買う', source: '買ってしまう', rule: 'v5', reasons: ['-te', '-shimau']}
- ]
+ {term: '買う', source: '買ってしまう', rule: 'v5', reasons: ['-te', '-shimau']},
+ ],
},
{
category: '-ku verbs',
@@ -206,8 +206,8 @@ const tests = [
{term: '行く', source: '行っておる', rule: 'v5', reasons: ['-te', 'progressive or perfect']},
{term: '行く', source: '行ってる', rule: 'v5', reasons: ['-te', 'progressive or perfect']},
{term: '行く', source: '行っとる', rule: 'v5', reasons: ['-te', 'progressive or perfect']},
- {term: '行く', source: '行ってしまう', rule: 'v5', reasons: ['-te', '-shimau']}
- ]
+ {term: '行く', source: '行ってしまう', rule: 'v5', reasons: ['-te', '-shimau']},
+ ],
},
{
category: '-gu verbs',
@@ -260,8 +260,8 @@ const tests = [
{term: '泳ぐ', source: '泳いでいる', rule: 'v5', reasons: ['-te', 'progressive or perfect']},
{term: '泳ぐ', source: '泳いでおる', rule: 'v5', reasons: ['-te', 'progressive or perfect']},
{term: '泳ぐ', source: '泳いでる', rule: 'v5', reasons: ['-te', 'progressive or perfect']},
- {term: '泳ぐ', source: '泳いでしまう', rule: 'v5', reasons: ['-te', '-shimau']}
- ]
+ {term: '泳ぐ', source: '泳いでしまう', rule: 'v5', reasons: ['-te', '-shimau']},
+ ],
},
{
category: '-su verbs',
@@ -315,8 +315,8 @@ const tests = [
{term: '話す', source: '話しておる', rule: 'v5', reasons: ['-te', 'progressive or perfect']},
{term: '話す', source: '話してる', rule: 'v5', reasons: ['-te', 'progressive or perfect']},
{term: '話す', source: '話しとる', rule: 'v5', reasons: ['-te', 'progressive or perfect']},
- {term: '話す', source: '話してしまう', rule: 'v5', reasons: ['-te', '-shimau']}
- ]
+ {term: '話す', source: '話してしまう', rule: 'v5', reasons: ['-te', '-shimau']},
+ ],
},
{
category: '-tsu verbs',
@@ -370,8 +370,8 @@ const tests = [
{term: '待つ', source: '待っておる', rule: 'v5', reasons: ['-te', 'progressive or perfect']},
{term: '待つ', source: '待ってる', rule: 'v5', reasons: ['-te', 'progressive or perfect']},
{term: '待つ', source: '待っとる', rule: 'v5', reasons: ['-te', 'progressive or perfect']},
- {term: '待つ', source: '待ってしまう', rule: 'v5', reasons: ['-te', '-shimau']}
- ]
+ {term: '待つ', source: '待ってしまう', rule: 'v5', reasons: ['-te', '-shimau']},
+ ],
},
{
category: '-nu verbs',
@@ -424,8 +424,8 @@ const tests = [
{term: '死ぬ', source: '死んでいる', rule: 'v5', reasons: ['-te', 'progressive or perfect']},
{term: '死ぬ', source: '死んでおる', rule: 'v5', reasons: ['-te', 'progressive or perfect']},
{term: '死ぬ', source: '死んでる', rule: 'v5', reasons: ['-te', 'progressive or perfect']},
- {term: '死ぬ', source: '死んでしまう', rule: 'v5', reasons: ['-te', '-shimau']}
- ]
+ {term: '死ぬ', source: '死んでしまう', rule: 'v5', reasons: ['-te', '-shimau']},
+ ],
},
{
category: '-bu verbs',
@@ -478,8 +478,8 @@ const tests = [
{term: '遊ぶ', source: '遊んでいる', rule: 'v5', reasons: ['-te', 'progressive or perfect']},
{term: '遊ぶ', source: '遊んでおる', rule: 'v5', reasons: ['-te', 'progressive or perfect']},
{term: '遊ぶ', source: '遊んでる', rule: 'v5', reasons: ['-te', 'progressive or perfect']},
- {term: '遊ぶ', source: '遊んでしまう', rule: 'v5', reasons: ['-te', '-shimau']}
- ]
+ {term: '遊ぶ', source: '遊んでしまう', rule: 'v5', reasons: ['-te', '-shimau']},
+ ],
},
{
category: '-mu verbs',
@@ -532,8 +532,8 @@ const tests = [
{term: '飲む', source: '飲んでいる', rule: 'v5', reasons: ['-te', 'progressive or perfect']},
{term: '飲む', source: '飲んでおる', rule: 'v5', reasons: ['-te', 'progressive or perfect']},
{term: '飲む', source: '飲んでる', rule: 'v5', reasons: ['-te', 'progressive or perfect']},
- {term: '飲む', source: '飲んでしまう', rule: 'v5', reasons: ['-te', '-shimau']}
- ]
+ {term: '飲む', source: '飲んでしまう', rule: 'v5', reasons: ['-te', '-shimau']},
+ ],
},
{
category: 'godan verbs',
@@ -587,8 +587,8 @@ const tests = [
{term: '作る', source: '作っておる', rule: 'v5', reasons: ['-te', 'progressive or perfect']},
{term: '作る', source: '作ってる', rule: 'v5', reasons: ['-te', 'progressive or perfect']},
{term: '作る', source: '作っとる', rule: 'v5', reasons: ['-te', 'progressive or perfect']},
- {term: '作る', source: '作ってしまう', rule: 'v5', reasons: ['-te', '-shimau']}
- ]
+ {term: '作る', source: '作ってしまう', rule: 'v5', reasons: ['-te', '-shimau']},
+ ],
},
{
category: 'irregular verbs',
@@ -853,8 +853,8 @@ const tests = [
{term: 'くる', source: 'きておる', rule: 'vk', reasons: ['-te', 'progressive or perfect']},
{term: 'くる', source: 'きてる', rule: 'vk', reasons: ['-te', 'progressive or perfect']},
{term: 'くる', source: 'きとる', rule: 'vk', reasons: ['-te', 'progressive or perfect']},
- {term: 'くる', source: 'きてしまう', rule: 'vk', reasons: ['-te', '-shimau']}
- ]
+ {term: 'くる', source: 'きてしまう', rule: 'vk', reasons: ['-te', '-shimau']},
+ ],
},
{
category: '-zuru verbs',
@@ -915,8 +915,8 @@ const tests = [
{term: '論ずる', source: '論じておる', rule: 'vz', reasons: ['-te', 'progressive or perfect']},
{term: '論ずる', source: '論じてる', rule: 'vz', reasons: ['-te', 'progressive or perfect']},
{term: '論ずる', source: '論じとる', rule: 'vz', reasons: ['-te', 'progressive or perfect']},
- {term: '論ずる', source: '論じてしまう', rule: 'vz', reasons: ['-te', '-shimau']}
- ]
+ {term: '論ずる', source: '論じてしまう', rule: 'vz', reasons: ['-te', '-shimau']},
+ ],
},
{
category: '-e verbs',
@@ -967,8 +967,8 @@ const tests = [
{term: 'うまい', source: 'うめぇ', rule: 'adj-i', reasons: ['-e']},
{term: 'でかい', source: 'でけぇ', rule: 'adj-i', reasons: ['-e']},
{term: 'まずい', source: 'まっぜぇ', rule: 'adj-i', reasons: ['-e']},
- {term: 'あかい', source: 'あけぇ', rule: 'adj-i', reasons: ['-e']}
- ]
+ {term: 'あかい', source: 'あけぇ', rule: 'adj-i', reasons: ['-e']},
+ ],
},
{
category: 'irregular verbs',
@@ -1008,8 +1008,8 @@ const tests = [
{term: 'くる', source: 'くられない', rule: 'vk', reasons: null},
{term: 'くる', source: 'くられない', rule: 'vk', reasons: null},
{term: 'くる', source: 'くさせない', rule: 'vk', reasons: null},
- {term: 'くる', source: 'くさせられない', rule: 'vk', reasons: null}
- ]
+ {term: 'くる', source: 'くさせられない', rule: 'vk', reasons: null},
+ ],
},
{
category: 'uncommon irregular verbs',
@@ -1074,8 +1074,8 @@ const tests = [
{term: '沿う', source: '沿うたり', rule: 'v5', reasons: ['-tari']},
{term: '添う', source: '添うたり', rule: 'v5', reasons: ['-tari']},
{term: '副う', source: '副うたり', rule: 'v5', reasons: ['-tari']},
- {term: '厭う', source: '厭うたり', rule: 'v5', reasons: ['-tari']}
- ]
+ {term: '厭う', source: '厭うたり', rule: 'v5', reasons: ['-tari']},
+ ],
},
{
category: 'combinations',
@@ -1084,8 +1084,8 @@ const tests = [
{term: '抱き抱える', source: '抱き抱えていなければ', rule: 'v1', reasons: ['-te', 'progressive or perfect', 'negative', '-ba']},
{term: '抱きかかえる', source: '抱きかかえていなければ', rule: 'v1', reasons: ['-te', 'progressive or perfect', 'negative', '-ba']},
{term: '打ち込む', source: '打ち込んでいませんでした', rule: 'v5', reasons: ['-te', 'progressive or perfect', 'polite', 'negative', 'past']},
- {term: '食べる', source: '食べさせられたくなかった', rule: 'v1', reasons: ['causative', 'potential or passive', '-tai', 'negative', 'past']}
- ]
+ {term: '食べる', source: '食べさせられたくなかった', rule: 'v1', reasons: ['causative', 'potential or passive', '-tai', 'negative', 'past']},
+ ],
},
{
category: 'kawaii',
@@ -1093,15 +1093,15 @@ const tests = [
tests: [
{term: 'かわいい', source: 'かわいげ', rule: 'adj-i', reasons: ['-ge']},
{term: '可愛い', source: '可愛げ', rule: 'adj-i', reasons: ['-ge']},
- {term: '可愛い', source: '可愛気', rule: 'adj-i', reasons: ['-ge']}
- ]
+ {term: '可愛い', source: '可愛気', rule: 'adj-i', reasons: ['-ge']},
+ ],
},
{
category: 'incorrect -te rule chain',
valid: false,
tests: [
- {term: '食べる', source: '食べて', rule: null, reasons: ['-te', 'progressive or perfect', 'masu stem']}
- ]
+ {term: '食べる', source: '食べて', rule: null, reasons: ['-te', 'progressive or perfect', 'masu stem']},
+ ],
},
// Kansai-ben
{
@@ -1111,8 +1111,8 @@ const tests = [
{term: '宜しい', source: '宜しゅう', rule: null, reasons: ['adv', 'kansai-ben']},
{term: 'よろしい', source: 'よろしゅう', rule: null, reasons: ['adv', 'kansai-ben']},
{term: '良い', source: '良う', rule: null, reasons: ['adv', 'kansai-ben']},
- {term: 'よい', source: 'よう', rule: null, reasons: ['adv', 'kansai-ben']}
- ]
+ {term: 'よい', source: 'よう', rule: null, reasons: ['adv', 'kansai-ben']},
+ ],
},
{
category: '-te form of kansai-ben adjectives',
@@ -1121,8 +1121,8 @@ const tests = [
{term: 'よろしい', source: 'よろしゅうて', rule: null, reasons: ['-te', 'kansai-ben']},
{term: '宜しい', source: '宜しゅうて', rule: null, reasons: ['-te', 'kansai-ben']},
{term: 'よい', source: 'ようて', rule: null, reasons: ['-te', 'kansai-ben']},
- {term: '良い', source: '良うて', rule: null, reasons: ['-te', 'kansai-ben']}
- ]
+ {term: '良い', source: '良うて', rule: null, reasons: ['-te', 'kansai-ben']},
+ ],
},
{
category: 'Negative form of kansai-ben adjectives',
@@ -1131,16 +1131,16 @@ const tests = [
{term: 'よろしい', source: 'よろしゅうない', rule: null, reasons: ['negative', 'kansai-ben']},
{term: '宜しい', source: '宜しゅうない', rule: null, reasons: ['negative', 'kansai-ben']},
{term: 'よい', source: 'ようない', rule: null, reasons: ['negative', 'kansai-ben']},
- {term: '良い', source: '良うない', rule: null, reasons: ['negative', 'kansai-ben']}
- ]
+ {term: '良い', source: '良うない', rule: null, reasons: ['negative', 'kansai-ben']},
+ ],
},
{
category: 'Negative form of kansai-ben verbs',
valid: true,
tests: [
{term: '食べる', source: '食べへん', rule: null, reasons: ['negative', 'kansai-ben']},
- {term: '食べる', source: '食べへんかった', rule: null, reasons: ['negative', 'past', 'kansai-ben']}
- ]
+ {term: '食べる', source: '食べへんかった', rule: null, reasons: ['negative', 'past', 'kansai-ben']},
+ ],
},
{
category: '-te form of kansai-ben verbs',
@@ -1148,8 +1148,8 @@ const tests = [
tests: [
{term: '買う', source: '買うて', rule: null, reasons: ['-te', 'kansai-ben']},
{term: 'かう', source: 'こうて', rule: null, reasons: ['-te', 'kansai-ben']},
- {term: 'はう', source: 'ほうて', rule: null, reasons: ['-te', 'kansai-ben']}
- ]
+ {term: 'はう', source: 'ほうて', rule: null, reasons: ['-te', 'kansai-ben']},
+ ],
},
{
category: 'past form of kansai-ben terms',
@@ -1157,8 +1157,8 @@ const tests = [
tests: [
{term: '買う', source: '買うた', rule: null, reasons: ['past', 'kansai-ben']},
{term: 'かう', source: 'こうた', rule: null, reasons: ['past', 'kansai-ben']},
- {term: 'はう', source: 'ほうた', rule: null, reasons: ['past', 'kansai-ben']}
- ]
+ {term: 'はう', source: 'ほうた', rule: null, reasons: ['past', 'kansai-ben']},
+ ],
},
{
category: '-tara form of kansai-ben terms',
@@ -1166,9 +1166,9 @@ const tests = [
tests: [
{term: '買う', source: '買うたら', rule: null, reasons: ['-tara', 'kansai-ben']},
{term: 'かう', source: 'こうたら', rule: null, reasons: ['-tara', 'kansai-ben']},
- {term: 'はう', source: 'ほうたら', rule: null, reasons: ['-tara', 'kansai-ben']}
- ]
- }
+ {term: 'はう', source: 'ほうたら', rule: null, reasons: ['-tara', 'kansai-ben']},
+ ],
+ },
];
/* eslint-enable @stylistic/no-multi-spaces */
diff --git a/test/language/latin-transforms.test.js b/test/language/latin-transforms.test.js
index 238d8eaf..c3c65476 100644
--- a/test/language/latin-transforms.test.js
+++ b/test/language/latin-transforms.test.js
@@ -28,8 +28,8 @@ const tests = [
tests: [
{term: 'fluvius', source: 'fluvii', rule: 'n', reasons: ['plural']},
{term: 'magnus', source: 'magni', rule: 'adj', reasons: ['plural']},
- {term: 'insula', source: 'insulae', rule: 'n', reasons: ['plural']}
- ]
+ {term: 'insula', source: 'insulae', rule: 'n', reasons: ['plural']},
+ ],
},
{
category: 'adjective',
@@ -37,16 +37,16 @@ const tests = [
tests: [
{term: 'magnus', source: 'magna', rule: 'adj', reasons: ['feminine']},
{term: 'Graecus', source: 'Graecum', rule: 'adj', reasons: ['neuter']},
- {term: 'primus', source: 'prima', rule: 'adj', reasons: ['neuter', 'plural']}
- ]
+ {term: 'primus', source: 'prima', rule: 'adj', reasons: ['neuter', 'plural']},
+ ],
},
{
category: 'ablative',
valid: true,
tests: [
- {term: 'vocabulum', source: 'vocabulo', rule: 'n', reasons: ['ablative']}
- ]
- }
+ {term: 'vocabulum', source: 'vocabulo', rule: 'n', reasons: ['ablative']},
+ ],
+ },
];
/* eslint-enable @stylistic/no-multi-spaces */
diff --git a/test/language/spanish-transforms.test.js b/test/language/spanish-transforms.test.js
index 7a6ab729..0af2587a 100644
--- a/test/language/spanish-transforms.test.js
+++ b/test/language/spanish-transforms.test.js
@@ -34,15 +34,15 @@ const tests = [
{term: 'sí', source: 'síes', rule: 'ns', reasons: ['plural']},
{term: 'zigzag', source: 'zigzags', rule: 'ns', reasons: ['plural']},
{term: 'luz', source: 'luces', rule: 'ns', reasons: ['plural']},
- {term: 'canción', source: 'canciones', rule: 'ns', reasons: ['plural']}
- ]
+ {term: 'canción', source: 'canciones', rule: 'ns', reasons: ['plural']},
+ ],
},
{
category: 'feminine adjectives',
valid: true,
tests: [
- {term: 'rojo', source: 'roja', rule: 'adj', reasons: ['feminine adjective']}
- ]
+ {term: 'rojo', source: 'roja', rule: 'adj', reasons: ['feminine adjective']},
+ ],
},
{
category: 'present indicative verbs',
@@ -90,9 +90,9 @@ const tests = [
{term: 'ser', source: 'soy', rule: 'v', reasons: ['present indicative']},
{term: 'estar', source: 'estoy', rule: 'v', reasons: ['present indicative']},
{term: 'ir', source: 'voy', rule: 'v', reasons: ['present indicative']},
- {term: 'haber', source: 'he', rule: 'v', reasons: ['present indicative']}
- ]
- }
+ {term: 'haber', source: 'he', rule: 'v', reasons: ['present indicative']},
+ ],
+ },
];
const languageTransformer = new LanguageTransformer();
diff --git a/test/mocks/common.js b/test/mocks/common.js
index 339e3ea0..3309e9e6 100644
--- a/test/mocks/common.js
+++ b/test/mocks/common.js
@@ -28,8 +28,8 @@ export const chrome = {
runtime: {
getURL: (path) => {
return pathToFileURL(join(extDir, path.replace(/^\//, ''))).href;
- }
- }
+ },
+ },
};
/** @type {import('test/mocks').FetchMock} */
@@ -47,6 +47,6 @@ export async function fetch(url) {
status: 200,
statusText: 'OK',
text: async () => content.toString('utf8'),
- json: async () => parseJson(content.toString('utf8'))
+ json: async () => parseJson(content.toString('utf8')),
};
}
diff --git a/test/object-property-accessor.test.js b/test/object-property-accessor.test.js
index ce72553c..50f285c0 100644
--- a/test/object-property-accessor.test.js
+++ b/test/object-property-accessor.test.js
@@ -28,13 +28,13 @@ function createTestObject() {
value1: {
value2: {},
value3: [],
- value4: null
+ value4: null,
},
value5: [
{},
[],
- null
- ]
+ null,
+ ],
};
}
@@ -51,7 +51,7 @@ describe('ObjectPropertyAccessor', () => {
[['value5'], (object) => object.value5],
[['value5', 0], (object) => object.value5[0]],
[['value5', 1], (object) => object.value5[1]],
- [['value5', 2], (object) => object.value5[2]]
+ [['value5', 2], (object) => object.value5[2]],
];
for (const [pathArray, getExpected] of data) {
@@ -87,7 +87,7 @@ describe('ObjectPropertyAccessor', () => {
[['value5', 2, 'invalid'], 'Invalid path: value5[2].invalid'],
[['value5', 2, 0], 'Invalid path: value5[2][0]'],
[['value5', 2, 0, 'invalid'], 'Invalid path: value5[2][0]'],
- [['value5', 2.5], 'Invalid index']
+ [['value5', 2.5], 'Invalid index'],
];
for (const [pathArray, message] of data) {
@@ -107,7 +107,7 @@ describe('ObjectPropertyAccessor', () => {
['value5', 0],
['value5', 1],
['value5', 2],
- ['value5']
+ ['value5'],
];
for (const pathArray of data) {
@@ -137,7 +137,7 @@ describe('ObjectPropertyAccessor', () => {
[['value5', 2, 'invalid'], 'Invalid path: value5[2].invalid'],
[['value5', 2, 0], 'Invalid path: value5[2][0]'],
[['value5', 2, 0, 'invalid'], 'Invalid path: value5[2][0]'],
- [['value5', 2.5], 'Invalid index']
+ [['value5', 2.5], 'Invalid index'],
];
for (const [pathArray, message] of data) {
@@ -160,7 +160,7 @@ describe('ObjectPropertyAccessor', () => {
[['value1', 'value3'], (object) => !hasOwn(object.value1, 'value3')],
[['value1', 'value4'], (object) => !hasOwn(object.value1, 'value4')],
[['value1'], (object) => !hasOwn(object, 'value1')],
- [['value5'], (object) => !hasOwn(object, 'value5')]
+ [['value5'], (object) => !hasOwn(object, 'value5')],
];
for (const [pathArray, validate] of data) {
@@ -189,7 +189,7 @@ describe('ObjectPropertyAccessor', () => {
[['value5', 2.5], 'Invalid index'],
[['value5', 0], 'Invalid type'],
[['value5', 1], 'Invalid type'],
- [['value5', 2], 'Invalid type']
+ [['value5', 2], 'Invalid type'],
];
for (const [pathArray, message] of data) {
@@ -211,7 +211,7 @@ describe('ObjectPropertyAccessor', () => {
[['value5', 0], true],
[['value5', 1], true],
[['value5', 2], true],
- [['value5'], false]
+ [['value5'], false],
];
for (const [pathArray1, compareValues1] of data) {
@@ -242,7 +242,7 @@ describe('ObjectPropertyAccessor', () => {
[['0'], [], false, 'Invalid path 2'],
[[], ['0'], false, 'Invalid path 1'],
[[0], ['0'], false, 'Invalid path 1: [0]'],
- [['0'], [0], false, 'Invalid path 2: [0]']
+ [['0'], [0], false, 'Invalid path 2: [0]'],
];
for (const [pathArray1, pathArray2, checkRevert, message] of data) {
@@ -285,7 +285,7 @@ describe('ObjectPropertyAccessor', () => {
[['part1', 'part2', '3'], 'part1.part2["3"]'],
[['part1', 'part2', '3part'], 'part1.part2["3part"]'],
[['part1', 'part2', '3part', 'part4'], 'part1.part2["3part"].part4'],
- [['part1', 'part2', '3part', '4part'], 'part1.part2["3part"]["4part"]']
+ [['part1', 'part2', '3part', '4part'], 'part1.part2["3part"]["4part"]'],
];
for (const [pathArray, expected] of data) {
@@ -297,7 +297,7 @@ describe('ObjectPropertyAccessor', () => {
/** @type {[pathArray: unknown[], message: string][]} */
const data = [
[[1.5], 'Invalid index'],
- [[null], 'Invalid type: object']
+ [[null], 'Invalid type: object'],
];
for (const [pathArray, message] of data) {
@@ -323,7 +323,7 @@ describe('ObjectPropertyAccessor', () => {
['part1.part2["3part"].part4', ['part1', 'part2', '3part', 'part4']],
['part1.part2[\'3part\'].part4', ['part1', 'part2', '3part', 'part4']],
['part1.part2["3part"]["4part"]', ['part1', 'part2', '3part', '4part']],
- ['part1.part2[\'3part\'][\'4part\']', ['part1', 'part2', '3part', '4part']]
+ ['part1.part2[\'3part\'][\'4part\']', ['part1', 'part2', '3part', '4part']],
];
for (const [pathString, expected] of data) {
@@ -355,7 +355,7 @@ describe('ObjectPropertyAccessor', () => {
['part1[""', 'Path not terminated correctly'],
['part1[\'\'', 'Path not terminated correctly'],
['part1[0', 'Path not terminated correctly'],
- ['part1[0].', 'Path not terminated correctly']
+ ['part1[0].', 'Path not terminated correctly'],
];
for (const [pathString, message] of data) {
@@ -376,7 +376,7 @@ describe('ObjectPropertyAccessor', () => {
[[0], null, false],
['string', 0, false],
['string', 'length', false],
- ['string', null, false]
+ ['string', null, false],
];
for (const [object, property, expected] of data) {
@@ -398,7 +398,7 @@ describe('ObjectPropertyAccessor', () => {
[[0], null, false],
['string', 0, false],
['string', 'length', false],
- ['string', null, false]
+ ['string', null, false],
];
for (const [object, property, expected] of data) {
diff --git a/test/options-util.test.js b/test/options-util.test.js
index 4b4c3df9..a849fa32 100644
--- a/test/options-util.test.js
+++ b/test/options-util.test.js
@@ -69,7 +69,7 @@ function createProfileOptionsTestData1() {
showPitchAccentGraph: false,
showIframePopupsInRootFrame: false,
useSecurePopupFrameUrl: true,
- usePopupShadowDom: true
+ usePopupShadowDom: true,
},
audio: {
enabled: true,
@@ -77,7 +77,7 @@ function createProfileOptionsTestData1() {
volume: 100,
autoPlay: false,
customSourceUrl: 'http://localhost/audio.mp3?term={expression}&reading={reading}',
- textToSpeechVoice: 'example-voice'
+ textToSpeechVoice: 'example-voice',
},
scanning: {
middleMouse: true,
@@ -94,7 +94,7 @@ function createProfileOptionsTestData1() {
enableOnPopupExpressions: false,
enableOnSearchPage: true,
enableSearchTags: false,
- layoutAwareScan: false
+ layoutAwareScan: false,
},
translation: {
convertHalfWidthCharacters: 'false',
@@ -102,21 +102,21 @@ function createProfileOptionsTestData1() {
convertAlphabeticCharacters: 'false',
convertHiraganaToKatakana: 'false',
convertKatakanaToHiragana: 'variant',
- collapseEmphaticSequences: 'false'
+ collapseEmphaticSequences: 'false',
},
dictionaries: {
'Test Dictionary': {
priority: 0,
enabled: true,
- allowSecondarySearches: false
- }
+ allowSecondarySearches: false,
+ },
},
parsing: {
enableScanningParser: true,
enableMecabParser: false,
selectedParser: null,
termSpacing: true,
- readingMode: 'hiragana'
+ readingMode: 'hiragana',
},
anki: {
enable: false,
@@ -127,8 +127,8 @@ function createProfileOptionsTestData1() {
terms: {deck: '', model: '', fields: {}},
kanji: {deck: '', model: '', fields: {}},
duplicateScope: 'collection',
- fieldTemplates: null
- }
+ fieldTemplates: null,
+ },
};
}
@@ -147,48 +147,48 @@ function createOptionsTestData1() {
{
type: 'popupLevel',
operator: 'equal',
- value: 1
+ value: 1,
},
{
type: 'popupLevel',
operator: 'notEqual',
- value: 0
+ value: 0,
},
{
type: 'popupLevel',
operator: 'lessThan',
- value: 3
+ value: 3,
},
{
type: 'popupLevel',
operator: 'greaterThan',
- value: 0
+ value: 0,
},
{
type: 'popupLevel',
operator: 'lessThanOrEqual',
- value: 2
+ value: 2,
},
{
type: 'popupLevel',
operator: 'greaterThanOrEqual',
- value: 1
- }
- ]
+ value: 1,
+ },
+ ],
},
{
conditions: [
{
type: 'url',
operator: 'matchDomain',
- value: 'example.com'
+ value: 'example.com',
},
{
type: 'url',
operator: 'matchRegExp',
- value: 'example\\.com'
- }
- ]
+ value: 'example\\.com',
+ },
+ ],
},
{
conditions: [
@@ -197,39 +197,39 @@ function createOptionsTestData1() {
operator: 'are',
value: [
'ctrl',
- 'shift'
- ]
+ 'shift',
+ ],
},
{
type: 'modifierKeys',
operator: 'areNot',
value: [
'alt',
- 'shift'
- ]
+ 'shift',
+ ],
},
{
type: 'modifierKeys',
operator: 'include',
- value: 'alt'
+ value: 'alt',
},
{
type: 'modifierKeys',
operator: 'notInclude',
- value: 'ctrl'
- }
- ]
- }
- ]
- }
+ value: 'ctrl',
+ },
+ ],
+ },
+ ],
+ },
],
profileCurrent: 0,
version: 2,
global: {
database: {
- prefixWildcardsSupported: false
- }
- }
+ prefixWildcardsSupported: false,
+ },
+ },
};
}
@@ -280,7 +280,7 @@ function createProfileOptionsUpdatedTestData1() {
frequencyDisplayMode: 'split-tags-grouped',
termDisplayMode: 'ruby',
sortFrequencyDictionary: null,
- sortFrequencyDictionaryOrder: 'descending'
+ sortFrequencyDictionaryOrder: 'descending',
},
audio: {
enabled: true,
@@ -288,21 +288,21 @@ function createProfileOptionsUpdatedTestData1() {
{
type: 'jpod101',
url: '',
- voice: ''
+ voice: '',
},
{
type: 'text-to-speech',
url: '',
- voice: 'example-voice'
+ voice: 'example-voice',
},
{
type: 'custom',
url: 'http://localhost/audio.mp3?term={term}&reading={reading}',
- voice: ''
- }
+ voice: '',
+ },
],
volume: 100,
- autoPlay: false
+ autoPlay: false,
},
scanning: {
touchInputEnabled: true,
@@ -328,7 +328,7 @@ function createProfileOptionsUpdatedTestData1() {
onWebPages: false,
onPopupPages: false,
onSearchPages: false,
- onSearchQuery: false
+ onSearchQuery: false,
},
inputs: [
{
@@ -337,7 +337,7 @@ function createProfileOptionsUpdatedTestData1() {
types: {
mouse: true,
touch: false,
- pen: false
+ pen: false,
},
options: {
showAdvanced: false,
@@ -353,8 +353,8 @@ function createProfileOptionsUpdatedTestData1() {
scanOnPenPress: true,
scanOnPenRelease: false,
preventTouchScrolling: true,
- preventPenScrolling: true
- }
+ preventPenScrolling: true,
+ },
},
{
include: 'mouse2',
@@ -362,7 +362,7 @@ function createProfileOptionsUpdatedTestData1() {
types: {
mouse: true,
touch: false,
- pen: false
+ pen: false,
},
options: {
showAdvanced: false,
@@ -378,8 +378,8 @@ function createProfileOptionsUpdatedTestData1() {
scanOnPenPress: true,
scanOnPenRelease: false,
preventTouchScrolling: true,
- preventPenScrolling: true
- }
+ preventPenScrolling: true,
+ },
},
{
include: '',
@@ -387,7 +387,7 @@ function createProfileOptionsUpdatedTestData1() {
types: {
mouse: false,
touch: true,
- pen: true
+ pen: true,
},
options: {
showAdvanced: false,
@@ -403,17 +403,17 @@ function createProfileOptionsUpdatedTestData1() {
scanOnPenPress: true,
scanOnPenRelease: false,
preventTouchScrolling: true,
- preventPenScrolling: true
- }
- }
- ]
+ preventPenScrolling: true,
+ },
+ },
+ ],
},
translation: {
searchResolution: 'letter',
textReplacements: {
searchOriginal: true,
- groups: []
- }
+ groups: [],
+ },
},
dictionaries: [
{
@@ -423,15 +423,15 @@ function createProfileOptionsUpdatedTestData1() {
allowSecondarySearches: false,
definitionsCollapsible: 'not-collapsible',
partsOfSpeechFilter: true,
- useDeinflections: true
- }
+ useDeinflections: true,
+ },
],
parsing: {
enableScanningParser: true,
enableMecabParser: false,
selectedParser: null,
termSpacing: true,
- readingMode: 'hiragana'
+ readingMode: 'hiragana',
},
anki: {
enable: false,
@@ -449,7 +449,7 @@ function createProfileOptionsUpdatedTestData1() {
suspendNewCards: false,
noteGuiMode: 'browse',
apiKey: '',
- downloadTimeout: 0
+ downloadTimeout: 0,
},
sentenceParsing: {
scanExtent: 200,
@@ -470,8 +470,8 @@ function createProfileOptionsUpdatedTestData1() {
{enabled: true, character1: '︒', character2: null, includeCharacterAtStart: false, includeCharacterAtEnd: true},
{enabled: true, character1: '︕', character2: null, includeCharacterAtStart: false, includeCharacterAtEnd: true},
{enabled: true, character1: '︖', character2: null, includeCharacterAtStart: false, includeCharacterAtEnd: true},
- {enabled: true, character1: '︙', character2: null, includeCharacterAtStart: false, includeCharacterAtEnd: true}
- ]
+ {enabled: true, character1: '︙', character2: null, includeCharacterAtStart: false, includeCharacterAtEnd: true},
+ ],
},
inputs: {
/* eslint-disable @stylistic/no-multi-spaces */
@@ -493,8 +493,8 @@ function createProfileOptionsUpdatedTestData1() {
{action: 'viewNotes', argument: '', key: 'KeyV', modifiers: ['alt'], scopes: ['popup', 'search'], enabled: true},
{action: 'copyHostSelection', argument: '', key: 'KeyC', modifiers: ['ctrl'], scopes: ['popup'], enabled: true},
{action: 'profilePrevious', argument: '', key: 'Minus', modifiers: ['alt'], scopes: ['popup', 'search'], enabled: true},
- {action: 'profileNext', argument: '', key: 'Equal', modifiers: ['alt'], scopes: ['popup', 'search'], enabled: true}
- ]
+ {action: 'profileNext', argument: '', key: 'Equal', modifiers: ['alt'], scopes: ['popup', 'search'], enabled: true},
+ ],
/* eslint-enable @stylistic/no-multi-spaces */
},
popupWindow: {
@@ -505,17 +505,17 @@ function createProfileOptionsUpdatedTestData1() {
useLeft: false,
useTop: false,
windowType: 'popup',
- windowState: 'normal'
+ windowState: 'normal',
},
clipboard: {
enableBackgroundMonitor: false,
enableSearchPageMonitor: false,
autoSearchContent: true,
- maximumSearchLength: 1000
+ maximumSearchLength: 1000,
},
accessibility: {
- forceGoogleDocsHtmlRendering: false
- }
+ forceGoogleDocsHtmlRendering: false,
+ },
};
}
@@ -534,83 +534,83 @@ function createOptionsUpdatedTestData1() {
{
type: 'popupLevel',
operator: 'equal',
- value: '1'
+ value: '1',
},
{
type: 'popupLevel',
operator: 'notEqual',
- value: '0'
+ value: '0',
},
{
type: 'popupLevel',
operator: 'lessThan',
- value: '3'
+ value: '3',
},
{
type: 'popupLevel',
operator: 'greaterThan',
- value: '0'
+ value: '0',
},
{
type: 'popupLevel',
operator: 'lessThanOrEqual',
- value: '2'
+ value: '2',
},
{
type: 'popupLevel',
operator: 'greaterThanOrEqual',
- value: '1'
- }
- ]
+ value: '1',
+ },
+ ],
},
{
conditions: [
{
type: 'url',
operator: 'matchDomain',
- value: 'example.com'
+ value: 'example.com',
},
{
type: 'url',
operator: 'matchRegExp',
- value: 'example\\.com'
- }
- ]
+ value: 'example\\.com',
+ },
+ ],
},
{
conditions: [
{
type: 'modifierKeys',
operator: 'are',
- value: 'ctrl, shift'
+ value: 'ctrl, shift',
},
{
type: 'modifierKeys',
operator: 'areNot',
- value: 'alt, shift'
+ value: 'alt, shift',
},
{
type: 'modifierKeys',
operator: 'include',
- value: 'alt'
+ value: 'alt',
},
{
type: 'modifierKeys',
operator: 'notInclude',
- value: 'ctrl'
- }
- ]
- }
- ]
- }
+ value: 'ctrl',
+ },
+ ],
+ },
+ ],
+ },
],
profileCurrent: 0,
version: 37,
global: {
database: {
- prefixWildcardsSupported: false
- }
- }
+ prefixWildcardsSupported: false,
+ },
+ },
};
}
@@ -668,7 +668,7 @@ describe('OptionsUtil', () => {
},
(options) => {
options.profiles[0].options.audio.autoPlay = void 0;
- }
+ },
];
test.each(data)('default-test-%#', async (modify) => {
@@ -704,7 +704,7 @@ describe('OptionsUtil', () => {
if (match !== null) {
updates.push({
version: Number.parseInt(match[1], 10),
- changes: loadDataFile(path.join(templatesDirPath, match[0]))
+ changes: loadDataFile(path.join(templatesDirPath, match[0])),
});
}
}
@@ -742,7 +742,7 @@ describe('OptionsUtil', () => {
{{/inline}}
<<<UPDATE-ADDITIONS>>>
-{{~> (lookup . "marker") ~}}`.trimStart()
+{{~> (lookup . "marker") ~}}`.trimStart(),
},
// Non-standard marker format
{
@@ -761,7 +761,7 @@ describe('OptionsUtil', () => {
{{/inline}}
{{~> (lookup . "marker2") ~}}
-<<<UPDATE-ADDITIONS>>>`.trimStart()
+<<<UPDATE-ADDITIONS>>>`.trimStart(),
},
// Empty test
{
@@ -772,7 +772,7 @@ describe('OptionsUtil', () => {
expected: `
<<<UPDATE-ADDITIONS>>>
-{{~> (lookup . "marker") ~}}`.trimStart()
+{{~> (lookup . "marker") ~}}`.trimStart(),
},
// Definition tags update
{
@@ -845,7 +845,7 @@ describe('OptionsUtil', () => {
<<<UPDATE-ADDITIONS>>>
{{~> (lookup . "marker") ~}}
-`.trimStart()
+`.trimStart(),
},
// Glossary and glossary-brief update
{
@@ -985,7 +985,7 @@ describe('OptionsUtil', () => {
{{/inline}}
<<<UPDATE-ADDITIONS>>>
-{{~> (lookup . "marker") ~}}`.trimStart()
+{{~> (lookup . "marker") ~}}`.trimStart(),
},
// formatGlossary update
{
@@ -1016,7 +1016,7 @@ describe('OptionsUtil', () => {
{{/inline}}
<<<UPDATE-ADDITIONS>>>
-{{~> (lookup . "marker") ~}}`.trimStart()
+{{~> (lookup . "marker") ~}}`.trimStart(),
},
// hasMedia/getMedia update
{
@@ -1069,7 +1069,7 @@ describe('OptionsUtil', () => {
{{/inline}}
<<<UPDATE-ADDITIONS>>>
-{{~> (lookup . "marker") ~}}`.trimStart()
+{{~> (lookup . "marker") ~}}`.trimStart(),
},
// hasMedia/getMedia update
{
@@ -1237,7 +1237,7 @@ describe('OptionsUtil', () => {
{{! End Pitch Accents }}
<<<UPDATE-ADDITIONS>>>
-{{~> (lookup . "marker") ~}}`.trimStart()
+{{~> (lookup . "marker") ~}}`.trimStart(),
},
// Block helper update: furigana and furiganaPlain
{
@@ -1325,7 +1325,7 @@ describe('OptionsUtil', () => {
{{~/if~}}
{{/inline}}
-{{~> (lookup . "marker") ~}}`.trimStart()
+{{~> (lookup . "marker") ~}}`.trimStart(),
},
// Block helper update: formatGlossary
{
@@ -1399,7 +1399,7 @@ describe('OptionsUtil', () => {
{{~set "previousDictionary" dictionary~}}
{{/inline}}
-{{~> (lookup . "marker") ~}}`.trimStart()
+{{~> (lookup . "marker") ~}}`.trimStart(),
},
// Block helper update: set and get
{
@@ -1501,7 +1501,7 @@ describe('OptionsUtil', () => {
{{~/scope~}}
{{/inline}}
-{{~> (lookup . "marker") ~}}`.trimStart()
+{{~> (lookup . "marker") ~}}`.trimStart(),
},
// Block helper update: hasMedia and getMedia
{
@@ -1583,7 +1583,7 @@ describe('OptionsUtil', () => {
{{~/if~}}
{{/inline}}
-{{~> (lookup . "marker") ~}}`.trimStart()
+{{~> (lookup . "marker") ~}}`.trimStart(),
},
// Block helper update: pronunciation
{
@@ -1601,7 +1601,7 @@ describe('OptionsUtil', () => {
{{~pronunciation format=format reading=reading downstepPosition=position nasalPositions=nasalPositions devoicePositions=devoicePositions~}}
{{/inline}}
-{{~> (lookup . "marker") ~}}`.trimStart()
+{{~> (lookup . "marker") ~}}`.trimStart(),
},
{
oldVersion: 21,
@@ -1695,7 +1695,7 @@ describe('OptionsUtil', () => {
{{~#*inline "pitch-accent-categories"~}}
{{~#each (pitchCategories @root)~}}{{~.~}}{{~#unless @last~}},{{~/unless~}}{{~/each~}}
-{{~/inline~}}`.trimStart()
+{{~/inline~}}`.trimStart(),
},
{
oldVersion: 24,
@@ -1722,7 +1722,7 @@ describe('OptionsUtil', () => {
{{~/if~}}
{{~/if~}}
{{/inline}}
-`.trimStart()
+`.trimStart(),
},
{
oldVersion: 32,
@@ -1785,8 +1785,8 @@ describe('OptionsUtil', () => {
{{#*inline "selection-text"}}
{{~#if (hasMedia "selectionText")}}{{{getMedia "selectionText"}}}{{/if~}}
{{/inline}}
-`.trimStart()
- }
+`.trimStart(),
+ },
];
const updatesPattern = /<<<UPDATE-ADDITIONS>>>/g;
diff --git a/test/playwright/integration.spec.js b/test/playwright/integration.spec.js
index bdbe80e3..b9f51700 100644
--- a/test/playwright/integration.spec.js
+++ b/test/playwright/integration.spec.js
@@ -25,7 +25,7 @@ import {
mockAnkiRouteHandler,
root,
test,
- writeToClipboardFromPage
+ writeToClipboardFromPage,
} from './playwright-util.js';
test.beforeEach(async ({context}) => {
@@ -71,7 +71,7 @@ test('anki add', async ({context, page, extensionId}) => {
await page.locator('input[id="dictionary-import-file-input"]').setInputFiles({
name: 'valid-dictionary1.zip',
mimeType: 'application/x-zip',
- buffer: Buffer.from(dictionary)
+ buffer: Buffer.from(dictionary),
});
await expect(page.locator('id=dictionaries')).toHaveText('Dictionaries (1 installed, 1 enabled)', {timeout: 5 * 60 * 1000});
diff --git a/test/playwright/playwright-util.js b/test/playwright/playwright-util.js
index bebbf08c..d8ecafa2 100644
--- a/test/playwright/playwright-util.js
+++ b/test/playwright/playwright-util.js
@@ -32,8 +32,8 @@ export const test = base.extend({
args: [
'--headless=new',
`--disable-extensions-except=${pathToExtension}`,
- `--load-extension=${pathToExtension}`
- ]
+ `--load-extension=${pathToExtension}`,
+ ],
});
await use(context);
await context.close();
@@ -46,7 +46,7 @@ export const test = base.extend({
const extensionId = background.url().split('/')[2];
await use(extensionId);
- }
+ },
});
export const expect = test.expect;
@@ -59,7 +59,7 @@ export function getMockModelFields() {
['Word', '{expression}'],
['Reading', '{furigana-plain}'],
['Sentence', '{clipboard-text}'],
- ['Audio', '{audio}']
+ ['Audio', '{audio}'],
]);
}
@@ -78,7 +78,7 @@ export async function mockAnkiRouteHandler(route) {
const responseJson = {
status: 200,
contentType: 'text/json',
- body: JSON.stringify(body)
+ body: JSON.stringify(body),
};
await route.fulfill(responseJson);
} catch {
@@ -108,7 +108,7 @@ export function getExpectedAddNoteBody() {
Word: '読む',
Reading: '読[よ]む',
Audio: '[sound:mock_audio.mp3]',
- Sentence: '読むの例文'
+ Sentence: '読むの例文',
},
tags: ['yomitan'],
deckName: 'Mock Deck',
@@ -119,11 +119,11 @@ export function getExpectedAddNoteBody() {
duplicateScopeOptions: {
deckName: null,
checkChildren: false,
- checkAllModels: false
- }
- }
- }
- }
+ checkAllModels: false,
+ },
+ },
+ },
+ },
};
}
diff --git a/test/profile-conditions-util.test.js b/test/profile-conditions-util.test.js
index 590e5873..e85a6997 100644
--- a/test/profile-conditions-util.test.js
+++ b/test/profile-conditions-util.test.js
@@ -26,26 +26,26 @@ describe('Profile conditions utilities', () => {
// Empty
{
context: {index: 0},
- expected: {index: 0, flags: []}
+ expected: {index: 0, flags: []},
},
// Domain normalization
{
context: {depth: 0, url: ''},
- expected: {depth: 0, url: '', flags: []}
+ expected: {depth: 0, url: '', flags: []},
},
{
context: {depth: 0, url: 'http://example.com/'},
- expected: {depth: 0, url: 'http://example.com/', domain: 'example.com', flags: []}
+ expected: {depth: 0, url: 'http://example.com/', domain: 'example.com', flags: []},
},
{
context: {depth: 0, url: 'http://example.com:1234/'},
- expected: {depth: 0, url: 'http://example.com:1234/', domain: 'example.com', flags: []}
+ expected: {depth: 0, url: 'http://example.com:1234/', domain: 'example.com', flags: []},
},
{
context: {depth: 0, url: 'http://user@example.com:1234/'},
- expected: {depth: 0, url: 'http://user@example.com:1234/', domain: 'example.com', flags: []}
- }
+ expected: {depth: 0, url: 'http://user@example.com:1234/', domain: 'example.com', flags: []},
+ },
];
test.each(data)('normalize-context-test-%#', ({context, expected}) => {
@@ -63,27 +63,27 @@ describe('Profile conditions utilities', () => {
conditionGroups: [],
expectedSchema: {},
inputs: [
- {expected: true, context: {depth: 0, url: 'http://example.com/'}}
- ]
+ {expected: true, context: {depth: 0, url: 'http://example.com/'}},
+ ],
},
{
conditionGroups: [
- {conditions: []}
+ {conditions: []},
],
expectedSchema: {},
inputs: [
- {expected: true, context: {depth: 0, url: 'http://example.com/'}}
- ]
+ {expected: true, context: {depth: 0, url: 'http://example.com/'}},
+ ],
},
{
conditionGroups: [
{conditions: []},
- {conditions: []}
+ {conditions: []},
],
expectedSchema: {},
inputs: [
- {expected: true, context: {depth: 0, url: 'http://example.com/'}}
- ]
+ {expected: true, context: {depth: 0, url: 'http://example.com/'}},
+ ],
},
// popupLevel tests
@@ -94,22 +94,22 @@ describe('Profile conditions utilities', () => {
{
type: 'popupLevel',
operator: 'equal',
- value: '0'
- }
- ]
- }
+ value: '0',
+ },
+ ],
+ },
],
expectedSchema: {
properties: {
- depth: {const: 0}
+ depth: {const: 0},
},
- required: ['depth']
+ required: ['depth'],
},
inputs: [
{expected: true, context: {depth: 0, url: 'http://example.com/'}},
{expected: false, context: {depth: 1, url: 'http://example.com/'}},
- {expected: false, context: {depth: -1, url: 'http://example.com/'}}
- ]
+ {expected: false, context: {depth: -1, url: 'http://example.com/'}},
+ ],
},
{
conditionGroups: [
@@ -118,28 +118,28 @@ describe('Profile conditions utilities', () => {
{
type: 'popupLevel',
operator: 'notEqual',
- value: '0'
- }
- ]
- }
+ value: '0',
+ },
+ ],
+ },
],
expectedSchema: {
not: {
anyOf: [
{
properties: {
- depth: {const: 0}
+ depth: {const: 0},
},
- required: ['depth']
- }
- ]
- }
+ required: ['depth'],
+ },
+ ],
+ },
},
inputs: [
{expected: false, context: {depth: 0, url: 'http://example.com/'}},
{expected: true, context: {depth: 1, url: 'http://example.com/'}},
- {expected: true, context: {depth: -1, url: 'http://example.com/'}}
- ]
+ {expected: true, context: {depth: -1, url: 'http://example.com/'}},
+ ],
},
{
conditionGroups: [
@@ -148,25 +148,25 @@ describe('Profile conditions utilities', () => {
{
type: 'popupLevel',
operator: 'lessThan',
- value: '0'
- }
- ]
- }
+ value: '0',
+ },
+ ],
+ },
],
expectedSchema: {
properties: {
depth: {
type: 'number',
- exclusiveMaximum: 0
- }
+ exclusiveMaximum: 0,
+ },
},
- required: ['depth']
+ required: ['depth'],
},
inputs: [
{expected: false, context: {depth: 0, url: 'http://example.com/'}},
{expected: false, context: {depth: 1, url: 'http://example.com/'}},
- {expected: true, context: {depth: -1, url: 'http://example.com/'}}
- ]
+ {expected: true, context: {depth: -1, url: 'http://example.com/'}},
+ ],
},
{
conditionGroups: [
@@ -175,25 +175,25 @@ describe('Profile conditions utilities', () => {
{
type: 'popupLevel',
operator: 'greaterThan',
- value: '0'
- }
- ]
- }
+ value: '0',
+ },
+ ],
+ },
],
expectedSchema: {
properties: {
depth: {
type: 'number',
- exclusiveMinimum: 0
- }
+ exclusiveMinimum: 0,
+ },
},
- required: ['depth']
+ required: ['depth'],
},
inputs: [
{expected: false, context: {depth: 0, url: 'http://example.com/'}},
{expected: true, context: {depth: 1, url: 'http://example.com/'}},
- {expected: false, context: {depth: -1, url: 'http://example.com/'}}
- ]
+ {expected: false, context: {depth: -1, url: 'http://example.com/'}},
+ ],
},
{
conditionGroups: [
@@ -202,25 +202,25 @@ describe('Profile conditions utilities', () => {
{
type: 'popupLevel',
operator: 'lessThanOrEqual',
- value: '0'
- }
- ]
- }
+ value: '0',
+ },
+ ],
+ },
],
expectedSchema: {
properties: {
depth: {
type: 'number',
- maximum: 0
- }
+ maximum: 0,
+ },
},
- required: ['depth']
+ required: ['depth'],
},
inputs: [
{expected: true, context: {depth: 0, url: 'http://example.com/'}},
{expected: false, context: {depth: 1, url: 'http://example.com/'}},
- {expected: true, context: {depth: -1, url: 'http://example.com/'}}
- ]
+ {expected: true, context: {depth: -1, url: 'http://example.com/'}},
+ ],
},
{
conditionGroups: [
@@ -229,25 +229,25 @@ describe('Profile conditions utilities', () => {
{
type: 'popupLevel',
operator: 'greaterThanOrEqual',
- value: '0'
- }
- ]
- }
+ value: '0',
+ },
+ ],
+ },
],
expectedSchema: {
properties: {
depth: {
type: 'number',
- minimum: 0
- }
+ minimum: 0,
+ },
},
- required: ['depth']
+ required: ['depth'],
},
inputs: [
{expected: true, context: {depth: 0, url: 'http://example.com/'}},
{expected: true, context: {depth: 1, url: 'http://example.com/'}},
- {expected: false, context: {depth: -1, url: 'http://example.com/'}}
- ]
+ {expected: false, context: {depth: -1, url: 'http://example.com/'}},
+ ],
},
// Url tests
@@ -258,28 +258,28 @@ describe('Profile conditions utilities', () => {
{
type: 'url',
operator: 'matchDomain',
- value: 'example.com'
- }
- ]
- }
+ value: 'example.com',
+ },
+ ],
+ },
],
expectedSchema: {
properties: {
domain: {
oneOf: [
- {const: 'example.com'}
- ]
- }
+ {const: 'example.com'},
+ ],
+ },
},
- required: ['domain']
+ required: ['domain'],
},
inputs: [
{expected: true, context: {depth: 0, url: 'http://example.com/'}},
{expected: false, context: {depth: 0, url: 'http://example1.com/'}},
{expected: false, context: {depth: 0, url: 'http://example2.com/'}},
{expected: true, context: {depth: 0, url: 'http://example.com:1234/'}},
- {expected: true, context: {depth: 0, url: 'http://user@example.com:1234/'}}
- ]
+ {expected: true, context: {depth: 0, url: 'http://user@example.com:1234/'}},
+ ],
},
{
conditionGroups: [
@@ -288,10 +288,10 @@ describe('Profile conditions utilities', () => {
{
type: 'url',
operator: 'matchDomain',
- value: 'example.com, example1.com, example2.com'
- }
- ]
- }
+ value: 'example.com, example1.com, example2.com',
+ },
+ ],
+ },
],
expectedSchema: {
properties: {
@@ -299,11 +299,11 @@ describe('Profile conditions utilities', () => {
oneOf: [
{const: 'example.com'},
{const: 'example1.com'},
- {const: 'example2.com'}
- ]
- }
+ {const: 'example2.com'},
+ ],
+ },
},
- required: ['domain']
+ required: ['domain'],
},
inputs: [
{expected: true, context: {depth: 0, url: 'http://example.com/'}},
@@ -311,8 +311,8 @@ describe('Profile conditions utilities', () => {
{expected: true, context: {depth: 0, url: 'http://example2.com/'}},
{expected: false, context: {depth: 0, url: 'http://example3.com/'}},
{expected: true, context: {depth: 0, url: 'http://example.com:1234/'}},
- {expected: true, context: {depth: 0, url: 'http://user@example.com:1234/'}}
- ]
+ {expected: true, context: {depth: 0, url: 'http://user@example.com:1234/'}},
+ ],
},
{
conditionGroups: [
@@ -321,20 +321,20 @@ describe('Profile conditions utilities', () => {
{
type: 'url',
operator: 'matchRegExp',
- value: '^http://example\\d?\\.com/[\\w\\W]*$'
- }
- ]
- }
+ value: '^http://example\\d?\\.com/[\\w\\W]*$',
+ },
+ ],
+ },
],
expectedSchema: {
properties: {
url: {
type: 'string',
pattern: '^http://example\\d?\\.com/[\\w\\W]*$',
- patternFlags: 'i'
- }
+ patternFlags: 'i',
+ },
},
- required: ['url']
+ required: ['url'],
},
inputs: [
{expected: true, context: {depth: 0, url: 'http://example.com/'}},
@@ -344,8 +344,8 @@ describe('Profile conditions utilities', () => {
{expected: true, context: {depth: 0, url: 'http://example.com/example'}},
{expected: false, context: {depth: 0, url: 'http://example.com:1234/'}},
{expected: false, context: {depth: 0, url: 'http://user@example.com:1234/'}},
- {expected: false, context: {depth: 0, url: 'http://example-1.com/'}}
- ]
+ {expected: false, context: {depth: 0, url: 'http://example-1.com/'}},
+ ],
},
// modifierKeys tests
@@ -356,27 +356,27 @@ describe('Profile conditions utilities', () => {
{
type: 'modifierKeys',
operator: 'are',
- value: ''
- }
- ]
- }
+ value: '',
+ },
+ ],
+ },
],
expectedSchema: {
properties: {
modifierKeys: {
type: 'array',
maxItems: 0,
- minItems: 0
- }
+ minItems: 0,
+ },
},
- required: ['modifierKeys']
+ required: ['modifierKeys'],
},
inputs: [
{expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: []}},
{expected: false, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt']}},
{expected: false, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift']}},
- {expected: false, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift', 'ctrl']}}
- ]
+ {expected: false, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift', 'ctrl']}},
+ ],
},
{
conditionGroups: [
@@ -385,10 +385,10 @@ describe('Profile conditions utilities', () => {
{
type: 'modifierKeys',
operator: 'are',
- value: 'alt, shift'
- }
- ]
- }
+ value: 'alt, shift',
+ },
+ ],
+ },
],
expectedSchema: {
properties: {
@@ -398,18 +398,18 @@ describe('Profile conditions utilities', () => {
minItems: 2,
allOf: [
{contains: {const: 'alt'}},
- {contains: {const: 'shift'}}
- ]
- }
+ {contains: {const: 'shift'}},
+ ],
+ },
},
- required: ['modifierKeys']
+ required: ['modifierKeys'],
},
inputs: [
{expected: false, context: {depth: 0, url: 'http://example.com/', modifierKeys: []}},
{expected: false, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt']}},
{expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift']}},
- {expected: false, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift', 'ctrl']}}
- ]
+ {expected: false, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift', 'ctrl']}},
+ ],
},
{
conditionGroups: [
@@ -418,10 +418,10 @@ describe('Profile conditions utilities', () => {
{
type: 'modifierKeys',
operator: 'areNot',
- value: ''
- }
- ]
- }
+ value: '',
+ },
+ ],
+ },
],
expectedSchema: {
not: {
@@ -431,20 +431,20 @@ describe('Profile conditions utilities', () => {
modifierKeys: {
type: 'array',
maxItems: 0,
- minItems: 0
- }
+ minItems: 0,
+ },
},
- required: ['modifierKeys']
- }
- ]
- }
+ required: ['modifierKeys'],
+ },
+ ],
+ },
},
inputs: [
{expected: false, context: {depth: 0, url: 'http://example.com/', modifierKeys: []}},
{expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt']}},
{expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift']}},
- {expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift', 'ctrl']}}
- ]
+ {expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift', 'ctrl']}},
+ ],
},
{
conditionGroups: [
@@ -453,10 +453,10 @@ describe('Profile conditions utilities', () => {
{
type: 'modifierKeys',
operator: 'areNot',
- value: 'alt, shift'
- }
- ]
- }
+ value: 'alt, shift',
+ },
+ ],
+ },
],
expectedSchema: {
not: {
@@ -469,21 +469,21 @@ describe('Profile conditions utilities', () => {
minItems: 2,
allOf: [
{contains: {const: 'alt'}},
- {contains: {const: 'shift'}}
- ]
- }
+ {contains: {const: 'shift'}},
+ ],
+ },
},
- required: ['modifierKeys']
- }
- ]
- }
+ required: ['modifierKeys'],
+ },
+ ],
+ },
},
inputs: [
{expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: []}},
{expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt']}},
{expected: false, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift']}},
- {expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift', 'ctrl']}}
- ]
+ {expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift', 'ctrl']}},
+ ],
},
{
conditionGroups: [
@@ -492,26 +492,26 @@ describe('Profile conditions utilities', () => {
{
type: 'modifierKeys',
operator: 'include',
- value: ''
- }
- ]
- }
+ value: '',
+ },
+ ],
+ },
],
expectedSchema: {
properties: {
modifierKeys: {
type: 'array',
- minItems: 0
- }
+ minItems: 0,
+ },
},
- required: ['modifierKeys']
+ required: ['modifierKeys'],
},
inputs: [
{expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: []}},
{expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt']}},
{expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift']}},
- {expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift', 'ctrl']}}
- ]
+ {expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift', 'ctrl']}},
+ ],
},
{
conditionGroups: [
@@ -520,10 +520,10 @@ describe('Profile conditions utilities', () => {
{
type: 'modifierKeys',
operator: 'include',
- value: 'alt, shift'
- }
- ]
- }
+ value: 'alt, shift',
+ },
+ ],
+ },
],
expectedSchema: {
properties: {
@@ -532,18 +532,18 @@ describe('Profile conditions utilities', () => {
minItems: 2,
allOf: [
{contains: {const: 'alt'}},
- {contains: {const: 'shift'}}
- ]
- }
+ {contains: {const: 'shift'}},
+ ],
+ },
},
- required: ['modifierKeys']
+ required: ['modifierKeys'],
},
inputs: [
{expected: false, context: {depth: 0, url: 'http://example.com/', modifierKeys: []}},
{expected: false, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt']}},
{expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift']}},
- {expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift', 'ctrl']}}
- ]
+ {expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift', 'ctrl']}},
+ ],
},
{
conditionGroups: [
@@ -552,25 +552,25 @@ describe('Profile conditions utilities', () => {
{
type: 'modifierKeys',
operator: 'notInclude',
- value: ''
- }
- ]
- }
+ value: '',
+ },
+ ],
+ },
],
expectedSchema: {
properties: {
modifierKeys: {
- type: 'array'
- }
+ type: 'array',
+ },
},
- required: ['modifierKeys']
+ required: ['modifierKeys'],
},
inputs: [
{expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: []}},
{expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt']}},
{expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift']}},
- {expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift', 'ctrl']}}
- ]
+ {expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift', 'ctrl']}},
+ ],
},
{
conditionGroups: [
@@ -579,10 +579,10 @@ describe('Profile conditions utilities', () => {
{
type: 'modifierKeys',
operator: 'notInclude',
- value: 'alt, shift'
- }
- ]
- }
+ value: 'alt, shift',
+ },
+ ],
+ },
],
expectedSchema: {
properties: {
@@ -591,19 +591,19 @@ describe('Profile conditions utilities', () => {
not: {
anyOf: [
{contains: {const: 'alt'}},
- {contains: {const: 'shift'}}
- ]
- }
- }
+ {contains: {const: 'shift'}},
+ ],
+ },
+ },
},
- required: ['modifierKeys']
+ required: ['modifierKeys'],
},
inputs: [
{expected: true, context: {depth: 0, url: 'http://example.com/', modifierKeys: []}},
{expected: false, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt']}},
{expected: false, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift']}},
- {expected: false, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift', 'ctrl']}}
- ]
+ {expected: false, context: {depth: 0, url: 'http://example.com/', modifierKeys: ['alt', 'shift', 'ctrl']}},
+ ],
},
// Flags tests
@@ -614,10 +614,10 @@ describe('Profile conditions utilities', () => {
{
type: 'flags',
operator: 'are',
- value: ''
- }
- ]
- }
+ value: '',
+ },
+ ],
+ },
],
expectedSchema: {
required: ['flags'],
@@ -625,9 +625,9 @@ describe('Profile conditions utilities', () => {
flags: {
type: 'array',
maxItems: 0,
- minItems: 0
- }
- }
+ minItems: 0,
+ },
+ },
},
inputs: [
{expected: true, context: {depth: 0, url: ''}},
@@ -636,8 +636,8 @@ describe('Profile conditions utilities', () => {
// @ts-expect-error - Ignore type for string flag for testing purposes
{expected: false, context: {depth: 0, url: '', flags: ['clipboard', 'test2']}},
// @ts-expect-error - Ignore type for string flag for testing purposes
- {expected: false, context: {depth: 0, url: '', flags: ['clipboard', 'test2', 'test3']}}
- ]
+ {expected: false, context: {depth: 0, url: '', flags: ['clipboard', 'test2', 'test3']}},
+ ],
},
{
conditionGroups: [
@@ -646,10 +646,10 @@ describe('Profile conditions utilities', () => {
{
type: 'flags',
operator: 'are',
- value: 'clipboard, test2'
- }
- ]
- }
+ value: 'clipboard, test2',
+ },
+ ],
+ },
],
expectedSchema: {
required: ['flags'],
@@ -660,10 +660,10 @@ describe('Profile conditions utilities', () => {
minItems: 2,
allOf: [
{contains: {const: 'clipboard'}},
- {contains: {const: 'test2'}}
- ]
- }
- }
+ {contains: {const: 'test2'}},
+ ],
+ },
+ },
},
inputs: [
{expected: false, context: {depth: 0, url: ''}},
@@ -672,8 +672,8 @@ describe('Profile conditions utilities', () => {
// @ts-expect-error - Ignore type for string flag for testing purposes
{expected: true, context: {depth: 0, url: '', flags: ['clipboard', 'test2']}},
// @ts-expect-error - Ignore type for string flag for testing purposes
- {expected: false, context: {depth: 0, url: '', flags: ['clipboard', 'test2', 'test3']}}
- ]
+ {expected: false, context: {depth: 0, url: '', flags: ['clipboard', 'test2', 'test3']}},
+ ],
},
{
conditionGroups: [
@@ -682,10 +682,10 @@ describe('Profile conditions utilities', () => {
{
type: 'flags',
operator: 'areNot',
- value: ''
- }
- ]
- }
+ value: '',
+ },
+ ],
+ },
],
expectedSchema: {
not: {
@@ -696,12 +696,12 @@ describe('Profile conditions utilities', () => {
flags: {
type: 'array',
maxItems: 0,
- minItems: 0
- }
- }
- }
- ]
- }
+ minItems: 0,
+ },
+ },
+ },
+ ],
+ },
},
inputs: [
{expected: false, context: {depth: 0, url: ''}},
@@ -710,8 +710,8 @@ describe('Profile conditions utilities', () => {
// @ts-expect-error - Ignore type for string flag for testing purposes
{expected: true, context: {depth: 0, url: '', flags: ['clipboard', 'test2']}},
// @ts-expect-error - Ignore type for string flag for testing purposes
- {expected: true, context: {depth: 0, url: '', flags: ['clipboard', 'test2', 'test3']}}
- ]
+ {expected: true, context: {depth: 0, url: '', flags: ['clipboard', 'test2', 'test3']}},
+ ],
},
{
conditionGroups: [
@@ -720,10 +720,10 @@ describe('Profile conditions utilities', () => {
{
type: 'flags',
operator: 'areNot',
- value: 'clipboard, test2'
- }
- ]
- }
+ value: 'clipboard, test2',
+ },
+ ],
+ },
],
expectedSchema: {
not: {
@@ -737,13 +737,13 @@ describe('Profile conditions utilities', () => {
minItems: 2,
allOf: [
{contains: {const: 'clipboard'}},
- {contains: {const: 'test2'}}
- ]
- }
- }
- }
- ]
- }
+ {contains: {const: 'test2'}},
+ ],
+ },
+ },
+ },
+ ],
+ },
},
inputs: [
{expected: true, context: {depth: 0, url: ''}},
@@ -752,8 +752,8 @@ describe('Profile conditions utilities', () => {
// @ts-expect-error - Ignore type for string flag for testing purposes
{expected: false, context: {depth: 0, url: '', flags: ['clipboard', 'test2']}},
// @ts-expect-error - Ignore type for string flag for testing purposes
- {expected: true, context: {depth: 0, url: '', flags: ['clipboard', 'test2', 'test3']}}
- ]
+ {expected: true, context: {depth: 0, url: '', flags: ['clipboard', 'test2', 'test3']}},
+ ],
},
{
conditionGroups: [
@@ -762,19 +762,19 @@ describe('Profile conditions utilities', () => {
{
type: 'flags',
operator: 'include',
- value: ''
- }
- ]
- }
+ value: '',
+ },
+ ],
+ },
],
expectedSchema: {
required: ['flags'],
properties: {
flags: {
type: 'array',
- minItems: 0
- }
- }
+ minItems: 0,
+ },
+ },
},
inputs: [
{expected: true, context: {depth: 0, url: ''}},
@@ -783,8 +783,8 @@ describe('Profile conditions utilities', () => {
// @ts-expect-error - Ignore type for string flag for testing purposes
{expected: true, context: {depth: 0, url: '', flags: ['clipboard', 'test2']}},
// @ts-expect-error - Ignore type for string flag for testing purposes
- {expected: true, context: {depth: 0, url: '', flags: ['clipboard', 'test2', 'test3']}}
- ]
+ {expected: true, context: {depth: 0, url: '', flags: ['clipboard', 'test2', 'test3']}},
+ ],
},
{
conditionGroups: [
@@ -793,10 +793,10 @@ describe('Profile conditions utilities', () => {
{
type: 'flags',
operator: 'include',
- value: 'clipboard, test2'
- }
- ]
- }
+ value: 'clipboard, test2',
+ },
+ ],
+ },
],
expectedSchema: {
required: ['flags'],
@@ -806,10 +806,10 @@ describe('Profile conditions utilities', () => {
minItems: 2,
allOf: [
{contains: {const: 'clipboard'}},
- {contains: {const: 'test2'}}
- ]
- }
- }
+ {contains: {const: 'test2'}},
+ ],
+ },
+ },
},
inputs: [
{expected: false, context: {depth: 0, url: ''}},
@@ -818,8 +818,8 @@ describe('Profile conditions utilities', () => {
// @ts-expect-error - Ignore type for string flag for testing purposes
{expected: true, context: {depth: 0, url: '', flags: ['clipboard', 'test2']}},
// @ts-expect-error - Ignore type for string flag for testing purposes
- {expected: true, context: {depth: 0, url: '', flags: ['clipboard', 'test2', 'test3']}}
- ]
+ {expected: true, context: {depth: 0, url: '', flags: ['clipboard', 'test2', 'test3']}},
+ ],
},
{
conditionGroups: [
@@ -828,18 +828,18 @@ describe('Profile conditions utilities', () => {
{
type: 'flags',
operator: 'notInclude',
- value: ''
- }
- ]
- }
+ value: '',
+ },
+ ],
+ },
],
expectedSchema: {
required: ['flags'],
properties: {
flags: {
- type: 'array'
- }
- }
+ type: 'array',
+ },
+ },
},
inputs: [
{expected: true, context: {depth: 0, url: ''}},
@@ -848,8 +848,8 @@ describe('Profile conditions utilities', () => {
// @ts-expect-error - Ignore type for string flag for testing purposes
{expected: true, context: {depth: 0, url: '', flags: ['clipboard', 'test2']}},
// @ts-expect-error - Ignore type for string flag for testing purposes
- {expected: true, context: {depth: 0, url: '', flags: ['clipboard', 'test2', 'test3']}}
- ]
+ {expected: true, context: {depth: 0, url: '', flags: ['clipboard', 'test2', 'test3']}},
+ ],
},
{
conditionGroups: [
@@ -858,10 +858,10 @@ describe('Profile conditions utilities', () => {
{
type: 'flags',
operator: 'notInclude',
- value: 'clipboard, test2'
- }
- ]
- }
+ value: 'clipboard, test2',
+ },
+ ],
+ },
],
expectedSchema: {
required: ['flags'],
@@ -871,11 +871,11 @@ describe('Profile conditions utilities', () => {
not: {
anyOf: [
{contains: {const: 'clipboard'}},
- {contains: {const: 'test2'}}
- ]
- }
- }
- }
+ {contains: {const: 'test2'}},
+ ],
+ },
+ },
+ },
},
inputs: [
{expected: true, context: {depth: 0, url: ''}},
@@ -884,8 +884,8 @@ describe('Profile conditions utilities', () => {
// @ts-expect-error - Ignore type for string flag for testing purposes
{expected: false, context: {depth: 0, url: '', flags: ['clipboard', 'test2']}},
// @ts-expect-error - Ignore type for string flag for testing purposes
- {expected: false, context: {depth: 0, url: '', flags: ['clipboard', 'test2', 'test3']}}
- ]
+ {expected: false, context: {depth: 0, url: '', flags: ['clipboard', 'test2', 'test3']}},
+ ],
},
// Multiple conditions tests
@@ -896,15 +896,15 @@ describe('Profile conditions utilities', () => {
{
type: 'popupLevel',
operator: 'greaterThan',
- value: '0'
+ value: '0',
},
{
type: 'popupLevel',
operator: 'lessThan',
- value: '3'
- }
- ]
- }
+ value: '3',
+ },
+ ],
+ },
],
expectedSchema: {
allOf: [
@@ -912,21 +912,21 @@ describe('Profile conditions utilities', () => {
properties: {
depth: {
type: 'number',
- exclusiveMinimum: 0
- }
+ exclusiveMinimum: 0,
+ },
},
- required: ['depth']
+ required: ['depth'],
},
{
properties: {
depth: {
type: 'number',
- exclusiveMaximum: 3
- }
+ exclusiveMaximum: 3,
+ },
},
- required: ['depth']
- }
- ]
+ required: ['depth'],
+ },
+ ],
},
inputs: [
{expected: false, context: {depth: -2, url: 'http://example.com/'}},
@@ -934,8 +934,8 @@ describe('Profile conditions utilities', () => {
{expected: false, context: {depth: 0, url: 'http://example.com/'}},
{expected: true, context: {depth: 1, url: 'http://example.com/'}},
{expected: true, context: {depth: 2, url: 'http://example.com/'}},
- {expected: false, context: {depth: 3, url: 'http://example.com/'}}
- ]
+ {expected: false, context: {depth: 3, url: 'http://example.com/'}},
+ ],
},
{
conditionGroups: [
@@ -944,24 +944,24 @@ describe('Profile conditions utilities', () => {
{
type: 'popupLevel',
operator: 'greaterThan',
- value: '0'
+ value: '0',
},
{
type: 'popupLevel',
operator: 'lessThan',
- value: '3'
- }
- ]
+ value: '3',
+ },
+ ],
},
{
conditions: [
{
type: 'popupLevel',
operator: 'equal',
- value: '0'
- }
- ]
- }
+ value: '0',
+ },
+ ],
+ },
],
expectedSchema: {
anyOf: [
@@ -971,29 +971,29 @@ describe('Profile conditions utilities', () => {
properties: {
depth: {
type: 'number',
- exclusiveMinimum: 0
- }
+ exclusiveMinimum: 0,
+ },
},
- required: ['depth']
+ required: ['depth'],
},
{
properties: {
depth: {
type: 'number',
- exclusiveMaximum: 3
- }
+ exclusiveMaximum: 3,
+ },
},
- required: ['depth']
- }
- ]
+ required: ['depth'],
+ },
+ ],
},
{
properties: {
- depth: {const: 0}
+ depth: {const: 0},
},
- required: ['depth']
- }
- ]
+ required: ['depth'],
+ },
+ ],
},
inputs: [
{expected: false, context: {depth: -2, url: 'http://example.com/'}},
@@ -1001,8 +1001,8 @@ describe('Profile conditions utilities', () => {
{expected: true, context: {depth: 0, url: 'http://example.com/'}},
{expected: true, context: {depth: 1, url: 'http://example.com/'}},
{expected: true, context: {depth: 2, url: 'http://example.com/'}},
- {expected: false, context: {depth: 3, url: 'http://example.com/'}}
- ]
+ {expected: false, context: {depth: 3, url: 'http://example.com/'}},
+ ],
},
{
conditionGroups: [
@@ -1011,29 +1011,29 @@ describe('Profile conditions utilities', () => {
{
type: 'popupLevel',
operator: 'greaterThan',
- value: '0'
+ value: '0',
},
{
type: 'popupLevel',
operator: 'lessThan',
- value: '3'
- }
- ]
+ value: '3',
+ },
+ ],
},
{
conditions: [
{
type: 'popupLevel',
operator: 'lessThanOrEqual',
- value: '0'
+ value: '0',
},
{
type: 'popupLevel',
operator: 'greaterThanOrEqual',
- value: '-1'
- }
- ]
- }
+ value: '-1',
+ },
+ ],
+ },
],
expectedSchema: {
anyOf: [
@@ -1043,21 +1043,21 @@ describe('Profile conditions utilities', () => {
properties: {
depth: {
type: 'number',
- exclusiveMinimum: 0
- }
+ exclusiveMinimum: 0,
+ },
},
- required: ['depth']
+ required: ['depth'],
},
{
properties: {
depth: {
type: 'number',
- exclusiveMaximum: 3
- }
+ exclusiveMaximum: 3,
+ },
},
- required: ['depth']
- }
- ]
+ required: ['depth'],
+ },
+ ],
},
{
allOf: [
@@ -1065,23 +1065,23 @@ describe('Profile conditions utilities', () => {
properties: {
depth: {
type: 'number',
- maximum: 0
- }
+ maximum: 0,
+ },
},
- required: ['depth']
+ required: ['depth'],
},
{
properties: {
depth: {
type: 'number',
- minimum: -1
- }
+ minimum: -1,
+ },
},
- required: ['depth']
- }
- ]
- }
- ]
+ required: ['depth'],
+ },
+ ],
+ },
+ ],
},
inputs: [
{expected: false, context: {depth: -2, url: 'http://example.com/'}},
@@ -1089,9 +1089,9 @@ describe('Profile conditions utilities', () => {
{expected: true, context: {depth: 0, url: 'http://example.com/'}},
{expected: true, context: {depth: 1, url: 'http://example.com/'}},
{expected: true, context: {depth: 2, url: 'http://example.com/'}},
- {expected: false, context: {depth: 3, url: 'http://example.com/'}}
- ]
- }
+ {expected: false, context: {depth: 3, url: 'http://example.com/'}},
+ ],
+ },
];
/* eslint-enable @stylistic/no-multi-spaces */
diff --git a/test/search-display-controller.test.js b/test/search-display-controller.test.js
index 277a51c3..51442781 100644
--- a/test/search-display-controller.test.js
+++ b/test/search-display-controller.test.js
@@ -66,7 +66,7 @@ describe('Keyboard Event Handling', () => {
const validKeypressEvents = [
new KeyboardEvent('keydown', {key: 'a', ctrlKey: false, metaKey: false, altKey: false}),
new KeyboardEvent('keydown', {key: 'Backspace'}),
- new KeyboardEvent('keydown', {key: 'Backspace', ctrlKey: true, metaKey: false, altKey: false})
+ new KeyboardEvent('keydown', {key: 'Backspace', ctrlKey: true, metaKey: false, altKey: false}),
];
const invalidKeypressEvents = [
@@ -79,7 +79,7 @@ describe('Keyboard Event Handling', () => {
new KeyboardEvent('keydown', {key: 'a', ctrlKey: false, metaKey: false, altKey: true}),
new KeyboardEvent('keydown', {key: 'Backspace', ctrlKey: false, metaKey: true, altKey: false}),
new KeyboardEvent('keydown', {key: 'Backspace', ctrlKey: false, metaKey: false, altKey: true}),
- new KeyboardEvent('keydown', {key: 'ArrowDown'})
+ new KeyboardEvent('keydown', {key: 'ArrowDown'}),
];
test('should test that onKeyDown function focuses input for valid keys', () => {
diff --git a/test/utilities/anki.js b/test/utilities/anki.js
index 550d0c0b..6471015a 100644
--- a/test/utilities/anki.js
+++ b/test/utilities/anki.js
@@ -53,9 +53,9 @@ export function createTestAnkiNoteData(dictionaryEntry, mode) {
sentence: {text: '', offset: 0},
documentTitle: 'title',
query: 'query',
- fullQuery: 'fullQuery'
+ fullQuery: 'fullQuery',
},
- media: {}
+ media: {},
};
return createAnkiNoteData(marker, data);
}
@@ -91,11 +91,11 @@ export async function getTemplateRenderResults(dictionaryEntries, mode, template
url: 'url:',
sentence: {
text: `${clozePrefix}${source}${clozeSuffix}`,
- offset: clozePrefix.length
+ offset: clozePrefix.length,
},
documentTitle: 'title',
query: 'query',
- fullQuery: 'fullQuery'
+ fullQuery: 'fullQuery',
};
/** @type {import('anki-note-builder').CreateNoteDetails} */
const details = {
@@ -113,7 +113,7 @@ export async function getTemplateRenderResults(dictionaryEntries, mode, template
glossaryLayoutMode: 'default',
compactTags: false,
requirements: [],
- mediaOptions: null
+ mediaOptions: null,
};
const {note: {fields: noteFields}, errors} = await ankiNoteBuilder.createNote(details);
for (const error of errors) {
diff --git a/test/utilities/translator.js b/test/utilities/translator.js
index e9c08443..e288c8df 100644
--- a/test/utilities/translator.js
+++ b/test/utilities/translator.js
@@ -78,7 +78,7 @@ export function createFindKanjiOptions(dictionaryName, optionsPresets, optionsAr
return {
enabledDictionaryMap,
- removeNonJapaneseCharacters: !!preset.removeNonJapaneseCharacters
+ removeNonJapaneseCharacters: !!preset.removeNonJapaneseCharacters,
};
}
@@ -126,7 +126,7 @@ export function createFindTermsOptions(dictionaryName, optionsPresets, optionsAr
removeNonJapaneseCharacters,
excludeDictionaryDefinitions,
searchResolution,
- language
+ language,
} = preset;
return {
@@ -140,6 +140,6 @@ export function createFindTermsOptions(dictionaryName, optionsPresets, optionsAr
enabledDictionaryMap,
excludeDictionaryDefinitions: Array.isArray(excludeDictionaryDefinitions) ? new Set(excludeDictionaryDefinitions) : null,
searchResolution: typeof searchResolution !== 'undefined' ? searchResolution : 'letter',
- language: typeof language !== 'undefined' ? language : 'ja'
+ language: typeof language !== 'undefined' ? language : 'ja',
};
}