aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-03-21 14:12:22 -0400
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-03-21 14:12:22 -0400
commit780d23b749325da0a95aa9cc7898df19f2ac1b31 (patch)
treee441e34e91bd29296e1ff903e7153245afc5cb94 /test
parent70284c62eea5a5f5dca16bf7b72ee4919c8450cd (diff)
Add more tests for convertReading
Diffstat (limited to 'test')
-rw-r--r--test/test-japanese.js42
1 files changed, 41 insertions, 1 deletions
diff --git a/test/test-japanese.js b/test/test-japanese.js
index 32e4d176..c5d220e7 100644
--- a/test/test-japanese.js
+++ b/test/test-japanese.js
@@ -188,7 +188,47 @@ function testConvertReading() {
[['有り難う', 'ありがとう', 'katakana'], 'アリガトウ'],
[['有り難う', 'ありがとう', 'romaji'], 'arigatou'],
[['有り難う', 'ありがとう', 'none'], null],
- [['有り難う', 'ありがとう', 'default'], 'ありがとう']
+ [['有り難う', 'ありがとう', 'default'], 'ありがとう'],
+
+ // Cases with falsy readings
+
+ [['ありがとう', '', 'hiragana'], ''],
+ [['ありがとう', '', 'katakana'], ''],
+ [['ありがとう', '', 'romaji'], 'arigatou'],
+ [['ありがとう', '', 'none'], null],
+ [['ありがとう', '', 'default'], ''],
+
+ [['ありがとう', null, 'hiragana'], ''],
+ [['ありがとう', null, 'katakana'], ''],
+ [['ありがとう', null, 'romaji'], 'arigatou'],
+ [['ありがとう', null, 'none'], null],
+ [['ありがとう', null, 'default'], null],
+
+ [['ありがとう', void 0, 'hiragana'], ''],
+ [['ありがとう', void 0, 'katakana'], ''],
+ [['ありがとう', void 0, 'romaji'], 'arigatou'],
+ [['ありがとう', void 0, 'none'], null],
+ [['ありがとう', void 0, 'default'], void 0],
+
+ // Cases with falsy readings and kanji expressions
+
+ [['有り難う', '', 'hiragana'], ''],
+ [['有り難う', '', 'katakana'], ''],
+ [['有り難う', '', 'romaji'], ''],
+ [['有り難う', '', 'none'], null],
+ [['有り難う', '', 'default'], ''],
+
+ [['有り難う', null, 'hiragana'], ''],
+ [['有り難う', null, 'katakana'], ''],
+ [['有り難う', null, 'romaji'], null],
+ [['有り難う', null, 'none'], null],
+ [['有り難う', null, 'default'], null],
+
+ [['有り難う', void 0, 'hiragana'], ''],
+ [['有り難う', void 0, 'katakana'], ''],
+ [['有り難う', void 0, 'romaji'], void 0],
+ [['有り難う', void 0, 'none'], null],
+ [['有り難う', void 0, 'default'], void 0]
];
for (const [[expressionFragment, readingFragment, readingMode], expected] of data) {