aboutsummaryrefslogtreecommitdiff
path: root/test/single/api-japanese.test.ts
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2023-07-06 16:22:26 +0200
committerlonkaars <loek@pipeframe.xyz>2023-07-06 16:22:26 +0200
commitcb78013884e3aa3b1e1a91722f5eeb78c62f6796 (patch)
tree72a40258a246607ecb59eb596e417f81181b59a7 /test/single/api-japanese.test.ts
parent4e32a1942ff2478b557af1b900b3f3282d7ce55b (diff)
update tests
Diffstat (limited to 'test/single/api-japanese.test.ts')
-rw-r--r--test/single/api-japanese.test.ts29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/single/api-japanese.test.ts b/test/single/api-japanese.test.ts
new file mode 100644
index 0000000..4e89c64
--- /dev/null
+++ b/test/single/api-japanese.test.ts
@@ -0,0 +1,29 @@
+import { assertEquals } from "../base.ts";
+
+import Japanese from "../../api/japanese.ts";
+
+interface Test {
+ input: [string, string];
+ output: string;
+};
+
+const cases = [
+ { input: ["繰り返す", "くりかえす"], output: "[繰](く)り[返](かえ)す" },
+ { input: ["漢字テスト", "かんじてすと"], output: "[漢字](かんじ)テスト" },
+ { input: ["凛々しく", "りりしく"], output: "[凛々](りり)しく" },
+ { input: ["字のテスト", "じのテスト"], output: "[字](じ)のテスト" },
+ { input: ["文字", "っ"], output: "[文字](っ)" },
+ { input: ["文字りす", "りりりす"], output: "[文字](りり)りす" },
+ { input: ["気を引き締める", "きをひきしめる"], output: "[気](き)を[引](ひ)き[締](し)める" },
+// https://japanese.stackexchange.com/questions/69521/reading-per-kanji-irregular-readings
+ { input: ["大口魚", "たら"], output: "[大口魚](たら)" },
+] satisfies Test[];
+
+cases.forEach(({ input, output }) => {
+ Deno.test(`Japanese API class - ${input}`, async () => {
+ var jp = new Japanese(...input);
+ assertEquals(jp.furigana("refold-tools"), output);
+ });
+});
+
+