summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/data/dictionaries/valid-dictionary1/index.json (renamed from test/test-dictionary-data/index.json)0
-rw-r--r--test/data/dictionaries/valid-dictionary1/kanji_bank_1.json (renamed from test/test-dictionary-data/kanji_bank_1.json)0
-rw-r--r--test/data/dictionaries/valid-dictionary1/kanji_meta_bank_1.json (renamed from test/test-dictionary-data/kanji_meta_bank_1.json)0
-rw-r--r--test/data/dictionaries/valid-dictionary1/tag_bank_1.json (renamed from test/test-dictionary-data/tag_bank_1.json)0
-rw-r--r--test/data/dictionaries/valid-dictionary1/tag_bank_2.json (renamed from test/test-dictionary-data/tag_bank_2.json)0
-rw-r--r--test/data/dictionaries/valid-dictionary1/term_bank_1.json (renamed from test/test-dictionary-data/term_bank_1.json)0
-rw-r--r--test/data/dictionaries/valid-dictionary1/term_meta_bank_1.json (renamed from test/test-dictionary-data/term_meta_bank_1.json)0
-rw-r--r--test/test-database.js4
-rw-r--r--test/test-dictionary.js2
-rw-r--r--test/yomichan-test.js15
10 files changed, 7 insertions, 14 deletions
diff --git a/test/test-dictionary-data/index.json b/test/data/dictionaries/valid-dictionary1/index.json
index 3034bf38..3034bf38 100644
--- a/test/test-dictionary-data/index.json
+++ b/test/data/dictionaries/valid-dictionary1/index.json
diff --git a/test/test-dictionary-data/kanji_bank_1.json b/test/data/dictionaries/valid-dictionary1/kanji_bank_1.json
index 264f94c1..264f94c1 100644
--- a/test/test-dictionary-data/kanji_bank_1.json
+++ b/test/data/dictionaries/valid-dictionary1/kanji_bank_1.json
diff --git a/test/test-dictionary-data/kanji_meta_bank_1.json b/test/data/dictionaries/valid-dictionary1/kanji_meta_bank_1.json
index 73e75b8a..73e75b8a 100644
--- a/test/test-dictionary-data/kanji_meta_bank_1.json
+++ b/test/data/dictionaries/valid-dictionary1/kanji_meta_bank_1.json
diff --git a/test/test-dictionary-data/tag_bank_1.json b/test/data/dictionaries/valid-dictionary1/tag_bank_1.json
index 109ad395..109ad395 100644
--- a/test/test-dictionary-data/tag_bank_1.json
+++ b/test/data/dictionaries/valid-dictionary1/tag_bank_1.json
diff --git a/test/test-dictionary-data/tag_bank_2.json b/test/data/dictionaries/valid-dictionary1/tag_bank_2.json
index 5e7936b3..5e7936b3 100644
--- a/test/test-dictionary-data/tag_bank_2.json
+++ b/test/data/dictionaries/valid-dictionary1/tag_bank_2.json
diff --git a/test/test-dictionary-data/term_bank_1.json b/test/data/dictionaries/valid-dictionary1/term_bank_1.json
index 755d9f6a..755d9f6a 100644
--- a/test/test-dictionary-data/term_bank_1.json
+++ b/test/data/dictionaries/valid-dictionary1/term_bank_1.json
diff --git a/test/test-dictionary-data/term_meta_bank_1.json b/test/data/dictionaries/valid-dictionary1/term_meta_bank_1.json
index 78096502..78096502 100644
--- a/test/test-dictionary-data/term_meta_bank_1.json
+++ b/test/data/dictionaries/valid-dictionary1/term_meta_bank_1.json
diff --git a/test/test-database.js b/test/test-database.js
index 801f9925..216ae5dd 100644
--- a/test/test-database.js
+++ b/test/test-database.js
@@ -121,7 +121,7 @@ async function clearDatabase() {
async function testDatabase1() {
// Load dictionary data
- const testDictionary = yomichanTest.createTestDictionaryArchive();
+ const testDictionary = yomichanTest.createTestDictionaryArchive('valid-dictionary1');
const testDictionarySource = await testDictionary.generateAsync({type: 'string'});
const testDictionaryIndex = JSON.parse(await testDictionary.files['index.json'].async('string'));
@@ -800,7 +800,7 @@ async function testFindTagForTitle1(database, title) {
async function testDatabase2() {
// Load dictionary data
- const testDictionary = yomichanTest.createTestDictionaryArchive();
+ const testDictionary = yomichanTest.createTestDictionaryArchive('valid-dictionary1');
const testDictionarySource = await testDictionary.generateAsync({type: 'string'});
const testDictionaryIndex = JSON.parse(await testDictionary.files['index.json'].async('string'));
diff --git a/test/test-dictionary.js b/test/test-dictionary.js
index 84014540..b9885edc 100644
--- a/test/test-dictionary.js
+++ b/test/test-dictionary.js
@@ -3,7 +3,7 @@ const dictionaryValidate = require('./dictionary-validate');
async function main() {
- const archive = yomichanTest.createTestDictionaryArchive();
+ const archive = yomichanTest.createTestDictionaryArchive('valid-dictionary1');
const schemas = dictionaryValidate.getSchemas();
await dictionaryValidate.validateDictionary(archive, schemas);
}
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;