diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-09-19 19:04:28 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-19 19:04:28 -0400 |
commit | 51d4e5b0ff4c0054bf5012464414ec0657d09963 (patch) | |
tree | 9920d1a9c84bf968ca8105700450792d78ac0088 /test/test-database.js | |
parent | 4293f731537906785da3b1f20535ddd18a4edd21 (diff) |
Dev/test script organization (#846)
* Move lint scripts
* Move dictionary-validate.js
* Move schema-validate.js
* Move createTestDictionaryArchive, remove yomichan-test.js
* Rename yomichan-util.js to util.js
* Move test/yomichan-vm.js to dev/vm.js
* Move getArgs into util.js (and fix name)
* Create test-all.js
* Update test-code script
Diffstat (limited to 'test/test-database.js')
-rw-r--r-- | test/test-database.js | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/test/test-database.js b/test/test-database.js index df152e57..dce89559 100644 --- a/test/test-database.js +++ b/test/test-database.js @@ -19,9 +19,8 @@ const fs = require('fs'); const url = require('url'); const path = require('path'); const assert = require('assert'); -const {JSZip} = require('../dev/yomichan-util'); -const {createTestDictionaryArchive} = require('./yomichan-test'); -const {VM} = require('./yomichan-vm'); +const {JSZip, createDictionaryArchive} = require('../dev/util'); +const {VM} = require('../dev/vm'); require('fake-indexeddb/auto'); const chrome = { @@ -125,6 +124,12 @@ const DictionaryImporter = vm.get('DictionaryImporter'); const DictionaryDatabase = vm.get('DictionaryDatabase'); +function createTestDictionaryArchive(dictionary, dictionaryName) { + const dictionaryDirectory = path.join(__dirname, 'data', 'dictionaries', dictionary); + return createDictionaryArchive(dictionaryDirectory, dictionaryName); +} + + function countTermsWithExpression(terms, expression) { return terms.reduce((i, v) => (i + (v.expression === expression ? 1 : 0)), 0); } |