diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2024-02-02 21:55:53 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-03 02:55:53 +0000 |
commit | c4f248b0f95050fb373c898289b506d042a3731b (patch) | |
tree | f221b6dfd6b806b5fa0f26b9e88c6feb764f60fd /test/dictionary-data.write.js | |
parent | 5a2bc4e542b7f22d1e6a4ba318cfcdc33817d34a (diff) |
Improve translator test inputs typing (#601)
* Add type identifier
* Improve type correctness of translator test utilities
Diffstat (limited to 'test/dictionary-data.write.js')
-rw-r--r-- | test/dictionary-data.write.js | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/test/dictionary-data.write.js b/test/dictionary-data.write.js index b27007e6..a6e14656 100644 --- a/test/dictionary-data.write.js +++ b/test/dictionary-data.write.js @@ -21,7 +21,7 @@ import path from 'path'; 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'; /** * @param {string} fileName @@ -62,8 +62,7 @@ test('Write dictionary data expected data', async ({window, translator, expect}) 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, null) : null; const noteDataList = mode !== 'simple' ? dictionaryEntries.map((dictionaryEntry) => createTestAnkiNoteData(dictionaryEntry, mode)) : null; @@ -75,8 +74,7 @@ test('Write dictionary data expected data', async ({window, translator, expect}) 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, null); const noteDataList = dictionaryEntries.map((dictionaryEntry) => createTestAnkiNoteData(dictionaryEntry, 'split')); |