aboutsummaryrefslogtreecommitdiff
path: root/test/fixtures/translator-test.js
diff options
context:
space:
mode:
authorStefanVukovic99 <stefanvukovic44@gmail.com>2024-03-22 15:27:35 +0100
committerGitHub <noreply@github.com>2024-03-22 14:27:35 +0000
commitd2e9841f96ebff61d4a5c26a322484f6268115f1 (patch)
tree3c1351fa3b25994eab8456ea8457ee153bb98aa9 /test/fixtures/translator-test.js
parent7681131782d958997663b1fb443a3e32e8eef550 (diff)
expand deinflection format (#745)
* abstract deinflections * undo redundant changes * remove cast * switch to js * MultiLanguageTransformer * comments * comments * fix test * suffixInflection * fix bench * substring instead of replace * without heuristic * suffixMap * add other language deinflections * wip * catch cycles * fix tests * uninflect to deinflect * use less regex * add suru masu stem deinflection
Diffstat (limited to 'test/fixtures/translator-test.js')
-rw-r--r--test/fixtures/translator-test.js11
1 files changed, 1 insertions, 10 deletions
diff --git a/test/fixtures/translator-test.js b/test/fixtures/translator-test.js
index 6b6eaad8..9f1e87df 100644
--- a/test/fixtures/translator-test.js
+++ b/test/fixtures/translator-test.js
@@ -17,12 +17,8 @@
*/
import {IDBKeyRange, indexedDB} from 'fake-indexeddb';
-import {readFileSync} from 'fs';
-import {fileURLToPath} from 'node:url';
-import {dirname, join} from 'path';
import {expect, vi} from 'vitest';
import {createDictionaryArchiveData} from '../../dev/dictionary-archive-util.js';
-import {parseJson} from '../../dev/json.js';
import {DictionaryDatabase} from '../../ext/js/dictionary/dictionary-database.js';
import {DictionaryImporter} from '../../ext/js/dictionary/dictionary-importer.js';
import {Translator} from '../../ext/js/language/translator.js';
@@ -30,9 +26,6 @@ import {chrome, fetch} from '../mocks/common.js';
import {DictionaryImporterMediaLoader} from '../mocks/dictionary-importer-media-loader.js';
import {createDomTest} from './dom-test.js';
-const extDir = join(dirname(fileURLToPath(import.meta.url)), '../../ext');
-const languageTransformDescriptorPath = join(extDir, 'js/language/ja/japanese-transforms.json');
-
vi.stubGlobal('indexedDB', indexedDB);
vi.stubGlobal('IDBKeyRange', IDBKeyRange);
vi.stubGlobal('fetch', fetch);
@@ -63,9 +56,7 @@ export async function createTranslatorContext(dictionaryDirectory, dictionaryNam
// Setup translator
const translator = new Translator(dictionaryDatabase);
- /** @type {import('language-transformer').LanguageTransformDescriptor} */
- const deinflectionReasons = parseJson(readFileSync(languageTransformDescriptorPath, {encoding: 'utf8'}));
- translator.prepare([deinflectionReasons]);
+ translator.prepare();
return translator;
}