aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/cache-map.test.js4
-rw-r--r--test/deinflector.test.js4
-rw-r--r--test/fixtures/anki-template-renderer-test.js1
-rw-r--r--test/hotkey-util.test.js6
-rw-r--r--test/json-schema.test.js6
-rw-r--r--test/options-util.test.js14
-rw-r--r--test/profile-conditions-util.test.js4
7 files changed, 21 insertions, 18 deletions
diff --git a/test/cache-map.test.js b/test/cache-map.test.js
index 72579f25..868c5d9a 100644
--- a/test/cache-map.test.js
+++ b/test/cache-map.test.js
@@ -16,8 +16,6 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-/* eslint-disable no-multi-spaces */
-
import {describe, expect, test} from 'vitest';
import {CacheMap} from '../ext/js/general/cache-map.js';
@@ -39,6 +37,7 @@ function testConstructor() {
/** */
function testApi() {
describe('api', () => {
+ /* eslint-disable no-multi-spaces */
const data = [
{
maxSize: 1,
@@ -90,6 +89,7 @@ function testApi() {
]
}
];
+ /* eslint-enable no-multi-spaces */
test.each(data)('api-test-%#', ({maxSize, expectedSize, calls}) => {
const cache = new CacheMap(maxSize);
diff --git a/test/deinflector.test.js b/test/deinflector.test.js
index e90704f1..660b909a 100644
--- a/test/deinflector.test.js
+++ b/test/deinflector.test.js
@@ -16,8 +16,6 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-/* eslint-disable no-multi-spaces */
-
import fs from 'fs';
import {fileURLToPath} from 'node:url';
import path from 'path';
@@ -62,6 +60,7 @@ function hasTermReasons(deinflector, source, expectedTerm, expectedRule, expecte
/** */
function testDeinflections() {
+ /* eslint-disable no-multi-spaces */
const data = [
{
valid: true,
@@ -933,6 +932,7 @@ function testDeinflections() {
]
}
];
+ /* eslint-enable no-multi-spaces */
/** @type {import('deinflector').ReasonsRaw} */
const deinflectionReasons = parseJson(fs.readFileSync(path.join(dirname, '..', 'ext', 'data/deinflect.json'), {encoding: 'utf8'}));
diff --git a/test/fixtures/anki-template-renderer-test.js b/test/fixtures/anki-template-renderer-test.js
index 90fa0440..de447126 100644
--- a/test/fixtures/anki-template-renderer-test.js
+++ b/test/fixtures/anki-template-renderer-test.js
@@ -32,7 +32,6 @@ export async function createAnkiTemplateRendererTest() {
/** @type {import('vitest').TestAPI<{window: import('jsdom').DOMWindow, ankiTemplateRenderer: AnkiTemplateRenderer}>} */
const result = test.extend({
window: async ({window}, use) => { await use(window); },
- // eslint-disable-next-line no-empty-pattern
ankiTemplateRenderer: async ({window}, use) => {
// The window property needs to be referenced for it to be initialized.
// It is needed for DOM access for structured content.
diff --git a/test/hotkey-util.test.js b/test/hotkey-util.test.js
index f87d0ffd..0a76d0f2 100644
--- a/test/hotkey-util.test.js
+++ b/test/hotkey-util.test.js
@@ -16,14 +16,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-/* eslint-disable no-multi-spaces */
-
import {describe, expect, test} from 'vitest';
import {HotkeyUtil} from '../ext/js/input/hotkey-util.js';
/** */
function testCommandConversions() {
describe('CommandConversions', () => {
+ /* eslint-disable no-multi-spaces */
/** @type {{os: import('environment').OperatingSystem, command: string, expectedCommand: string, expectedInput: {key: string, modifiers: import('input').Modifier[]}}[]} */
const data = [
{os: 'win', command: 'Alt+F', expectedCommand: 'Alt+F', expectedInput: {key: 'KeyF', modifiers: ['alt']}},
@@ -41,6 +40,7 @@ function testCommandConversions() {
{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']}}
];
+ /* eslint-enable no-multi-spaces */
const hotkeyUtil = new HotkeyUtil();
for (const {command, os, expectedInput, expectedCommand} of data) {
@@ -58,6 +58,7 @@ function testCommandConversions() {
/** */
function testDisplayNames() {
describe('DisplayNames', () => {
+ /* eslint-disable no-multi-spaces */
/** @type {{os: import('environment').OperatingSystem, key: ?string, modifiers: import('input').Modifier[], expected: string}[]} */
const data = [
{os: 'win', key: null, modifiers: [], expected: ''},
@@ -136,6 +137,7 @@ function testDisplayNames() {
{os: 'unknown', key: 'KeyF', modifiers: ['mouse1'], expected: 'Mouse 1 + F'},
{os: 'unknown', key: 'F1', modifiers: ['mouse1'], expected: 'Mouse 1 + F1'}
];
+ /* eslint-enable no-multi-spaces */
const hotkeyUtil = new HotkeyUtil();
diff --git a/test/json-schema.test.js b/test/json-schema.test.js
index fcb99ee4..a3686758 100644
--- a/test/json-schema.test.js
+++ b/test/json-schema.test.js
@@ -16,8 +16,6 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-/* eslint-disable no-multi-spaces */
-
import {describe, expect, test} from 'vitest';
import {parseJson} from '../dev/json.js';
import {JsonSchema} from '../ext/js/data/json-schema.js';
@@ -125,6 +123,7 @@ function testValidate1() {
/** */
function testValidate2() {
describe('Validate2', () => {
+ /* eslint-disable no-multi-spaces */
/** @type {{schema: import('ext/json-schema').Schema, inputs: {expected: boolean, value: unknown}[]}[]} */
const data = [
// String tests
@@ -518,6 +517,7 @@ function testValidate2() {
]
}
];
+ /* eslint-enable no-multi-spaces */
describe.each(data)('Schema %#', ({schema, inputs}) => {
test.each(inputs)(`schemaValidate(${schema}, $value) -> $expected`, ({expected, value}) => {
@@ -890,6 +890,7 @@ function testGetValidValueOrDefault1() {
/** */
function testProxy1() {
describe('Proxy1', () => {
+ /* eslint-disable no-multi-spaces */
/** @type {{schema: import('ext/json-schema').Schema, tests: {error: boolean, value?: import('ext/json-schema').Value, action: (value: import('core').SafeAny) => void}[]}[]} */
const data = [
// Object tests
@@ -1019,6 +1020,7 @@ function testProxy1() {
]
}
];
+ /* eslint-enable no-multi-spaces */
describe.each(data)('Schema %#', ({schema, tests}) => {
test.each(tests)('proxy %#', ({error, value, action}) => {
diff --git a/test/options-util.test.js b/test/options-util.test.js
index ded16b4c..25abe715 100644
--- a/test/options-util.test.js
+++ b/test/options-util.test.js
@@ -16,12 +16,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-/* eslint-disable no-multi-spaces */
-
import fs from 'fs';
import {fileURLToPath} from 'node:url';
import path from 'path';
-import {expect, test, describe, vi} from 'vitest';
+import {describe, expect, test, vi} from 'vitest';
import {OptionsUtil} from '../ext/js/data/options-util.js';
import {TemplatePatcher} from '../ext/js/templates/template-patcher.js';
import {chrome, fetch} from './mocks/common.js';
@@ -477,6 +475,7 @@ function createProfileOptionsUpdatedTestData1() {
]
},
inputs: {
+ /* eslint-disable no-multi-spaces */
hotkeys: [
{action: 'close', argument: '', key: 'Escape', modifiers: [], scopes: ['popup'], enabled: true},
{action: 'focusSearchBox', argument: '', key: 'Escape', modifiers: [], scopes: ['search'], enabled: true},
@@ -495,6 +494,7 @@ function createProfileOptionsUpdatedTestData1() {
{action: 'viewNote', argument: '', key: 'KeyV', modifiers: ['alt'], scopes: ['popup', 'search'], enabled: true},
{action: 'copyHostSelection', argument: '', key: 'KeyC', modifiers: ['ctrl'], scopes: ['popup'], enabled: true}
]
+ /* eslint-enable no-multi-spaces */
},
popupWindow: {
width: 400,
@@ -667,10 +667,10 @@ async function testFieldTemplatesUpdate() {
return templatePatcher.parsePatch(content).addition;
};
const updates = [
- {version: 2, changes: loadDataFile('data/templates/anki-field-templates-upgrade-v2.handlebars')},
- {version: 4, changes: loadDataFile('data/templates/anki-field-templates-upgrade-v4.handlebars')},
- {version: 6, changes: loadDataFile('data/templates/anki-field-templates-upgrade-v6.handlebars')},
- {version: 8, changes: loadDataFile('data/templates/anki-field-templates-upgrade-v8.handlebars')},
+ {version: 2, changes: loadDataFile('data/templates/anki-field-templates-upgrade-v2.handlebars')},
+ {version: 4, changes: loadDataFile('data/templates/anki-field-templates-upgrade-v4.handlebars')},
+ {version: 6, changes: loadDataFile('data/templates/anki-field-templates-upgrade-v6.handlebars')},
+ {version: 8, changes: loadDataFile('data/templates/anki-field-templates-upgrade-v8.handlebars')},
{version: 10, changes: loadDataFile('data/templates/anki-field-templates-upgrade-v10.handlebars')},
{version: 12, changes: loadDataFile('data/templates/anki-field-templates-upgrade-v12.handlebars')},
{version: 13, changes: loadDataFile('data/templates/anki-field-templates-upgrade-v13.handlebars')},
diff --git a/test/profile-conditions-util.test.js b/test/profile-conditions-util.test.js
index 417ca409..7af5f223 100644
--- a/test/profile-conditions-util.test.js
+++ b/test/profile-conditions-util.test.js
@@ -16,8 +16,6 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
-/* eslint-disable no-multi-spaces */
-
import {describe, expect, test} from 'vitest';
import {ProfileConditionsUtil} from '../ext/js/background/profile-conditions-util.js';
@@ -62,6 +60,7 @@ function testNormalizeContext() {
/** */
function testSchemas() {
describe('Schemas', () => {
+ /* eslint-disable no-multi-spaces */
/** @type {{conditionGroups: import('settings').ProfileConditionGroup[], expectedSchema?: import('ext/json-schema').Schema, inputs?: {expected: boolean, context: import('settings').OptionsContext}[]}[]} */
const data = [
// Empty
@@ -1099,6 +1098,7 @@ function testSchemas() {
]
}
];
+ /* eslint-enable no-multi-spaces */
test.each(data)('schemas-test-%#', ({conditionGroups, expectedSchema, inputs}) => {
const profileConditionsUtil = new ProfileConditionsUtil();