1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
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: "[大口魚](たら)" },
{ input: ["この辺に", "このへんに"], output: "この[辺](へん)に" },
] satisfies Test[];
cases.forEach(({ input, output }) => {
Deno.test(`Japanese API class - ${input[0]} (${input[1]}) -> ${output}`, async () => {
var jp = new Japanese(...input);
assertEquals(jp.furigana("refold-tools"), output);
});
});
|