summaryrefslogtreecommitdiff
path: root/test/dictionary-data.test.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2024-02-02 21:55:53 -0500
committerGitHub <noreply@github.com>2024-02-03 02:55:53 +0000
commitc4f248b0f95050fb373c898289b506d042a3731b (patch)
treef221b6dfd6b806b5fa0f26b9e88c6feb764f60fd /test/dictionary-data.test.js
parent5a2bc4e542b7f22d1e6a4ba318cfcdc33817d34a (diff)
Improve translator test inputs typing (#601)
* Add type identifier * Improve type correctness of translator test utilities
Diffstat (limited to 'test/dictionary-data.test.js')
-rw-r--r--test/dictionary-data.test.js8
1 files changed, 3 insertions, 5 deletions
diff --git a/test/dictionary-data.test.js b/test/dictionary-data.test.js
index 9f8ba6f0..dcc03d72 100644
--- a/test/dictionary-data.test.js
+++ b/test/dictionary-data.test.js
@@ -22,7 +22,7 @@ import {describe} from 'vitest';
import {parseJson} from '../dev/json.js';
import {createTranslatorTest} from './fixtures/translator-test.js';
import {createTestAnkiNoteData, getTemplateRenderResults} from './utilities/anki.js';
-import {createFindOptions} from './utilities/translator.js';
+import {createFindKanjiOptions, createFindTermsOptions} from './utilities/translator.js';
const dirname = path.dirname(fileURLToPath(import.meta.url));
const dictionaryName = 'Test Dictionary 2';
@@ -61,8 +61,7 @@ describe('Dictionary data', () => {
case 'findTerms':
{
const {mode, text} = data;
- /** @type {import('translation').FindTermsOptions} */
- const options = createFindOptions(dictionaryName, optionsPresets, data.options);
+ const options = createFindTermsOptions(dictionaryName, optionsPresets, data.options);
const {dictionaryEntries, originalTextLength} = await translator.findTerms(mode, text, options);
const renderResults = mode !== 'simple' ? await getTemplateRenderResults(dictionaryEntries, 'terms', mode, template, expect) : null;
const noteDataList = mode !== 'simple' ? dictionaryEntries.map((dictionaryEntry) => createTestAnkiNoteData(dictionaryEntry, mode)) : null;
@@ -75,8 +74,7 @@ describe('Dictionary data', () => {
case 'findKanji':
{
const {text} = data;
- /** @type {import('translation').FindKanjiOptions} */
- const options = createFindOptions(dictionaryName, optionsPresets, data.options);
+ const options = createFindKanjiOptions(dictionaryName, optionsPresets, data.options);
const dictionaryEntries = await translator.findKanji(text, options);
const renderResults = await getTemplateRenderResults(dictionaryEntries, 'kanji', 'split', template, expect);
const noteDataList = dictionaryEntries.map((dictionaryEntry) => createTestAnkiNoteData(dictionaryEntry, 'split'));