diff options
Diffstat (limited to 'test/reading')
-rw-r--r-- | test/reading/test.ts | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/test/reading/test.ts b/test/reading/test.ts index c1e7de4..e178543 100644 --- a/test/reading/test.ts +++ b/test/reading/test.ts @@ -1,12 +1,20 @@ -import { api, assertEquals, formatCaseIndex } from "../base.ts"; +import YomikunError from "../../util/error.ts"; +import { api, assertStrDiffMsg, formatCaseIndex } from "../base.ts"; import cases from "./cases.ts"; -cases.forEach(({input, output}, i) => { +cases.forEach((test, i) => { // if (i != 1) return; - Deno.test(`Sentence reading ${formatCaseIndex(i, cases.length)} - ${input}`, async () => { - // TODO: use sentence reading and tags - var sentence = await api.sentence(input); - assertEquals(sentence.furigana("refold-tools"), output); + Deno.test(`Sentence reading ${formatCaseIndex(i, cases.length)} - ${test.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)); + } }); }); |