aboutsummaryrefslogtreecommitdiff
path: root/test/single/api-japanese.test.ts
diff options
context:
space:
mode:
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);
+ });
+});
+
+