aboutsummaryrefslogtreecommitdiff
path: root/test/yomichan-test.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-02-22 14:34:20 -0500
committerGitHub <noreply@github.com>2020-02-22 14:34:20 -0500
commitf3c4b0e1e14cbdfb86c692e89144c762801b2339 (patch)
treee7e77fca7b151c1f9a17ab5a1314589a5578dd28 /test/yomichan-test.js
parent0e31139734efd51799efcb6357c074059c78858d (diff)
parenta2b72dd3ab4a560d4549aa52912fcb9cd9f275ab (diff)
Merge pull request #369 from toasted-nutbread/dictionary-validation
Dictionary validation
Diffstat (limited to 'test/yomichan-test.js')
-rw-r--r--test/yomichan-test.js15
1 files changed, 4 insertions, 11 deletions
diff --git a/test/yomichan-test.js b/test/yomichan-test.js
index dd4da919..939e0ad2 100644
--- a/test/yomichan-test.js
+++ b/test/yomichan-test.js
@@ -26,21 +26,14 @@ function getJSZip() {
return JSZip;
}
-function createTestDictionaryArchive(dictionaryName) {
- const fileNames = [
- 'index.json',
- 'tag_bank_1.json',
- 'tag_bank_2.json',
- 'term_bank_1.json',
- 'kanji_bank_1.json',
- 'term_meta_bank_1.json',
- 'kanji_meta_bank_1.json'
- ];
+function createTestDictionaryArchive(dictionary, dictionaryName) {
+ const dictionaryDirectory = path.join(__dirname, 'data', 'dictionaries', dictionary);
+ const fileNames = fs.readdirSync(dictionaryDirectory);
const archive = new (getJSZip())();
for (const fileName of fileNames) {
- const source = fs.readFileSync(path.join(__dirname, 'test-dictionary-data', fileName), {encoding: 'utf8'});
+ const source = fs.readFileSync(path.join(dictionaryDirectory, fileName), {encoding: 'utf8'});
const json = JSON.parse(source);
if (fileName === 'index.json' && typeof dictionaryName === 'string') {
json.title = dictionaryName;