diff options
Diffstat (limited to 'test/reading/test.ts')
-rw-r--r-- | test/reading/test.ts | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/test/reading/test.ts b/test/reading/test.ts index e178543..d74228c 100644 --- a/test/reading/test.ts +++ b/test/reading/test.ts @@ -1,20 +1,12 @@ -import YomikunError from "../../util/error.ts"; -import { api, assertStrDiffMsg, formatCaseIndex } from "../base.ts"; +import { api, assertStrDiff, formatCaseIndex } from "../base.ts"; import cases from "./cases.ts"; -cases.forEach((test, i) => { +cases.forEach(({input, output}, i) => { // if (i != 1) return; - Deno.test(`Sentence reading ${formatCaseIndex(i, cases.length)} - ${test.input}`, async () => { + Deno.test(`Sentence reading ${formatCaseIndex(i, cases.length)} - ${input}`, async () => { // TODO: use domain/series tags - var sentence = await api.sentence(test.input); - - const actual = sentence.furigana("refold-tools"); - const expected = test.output; - - // reading-only check (skip split reading across multiple kanji check) - if (sentence.reading != test.reading && actual != expected) { - throw new YomikunError(assertStrDiffMsg(expected, actual)); - } + var sentence = await api.sentence(input); + assertStrDiff(output, sentence.furigana("refold-tools")); }); }); |