aboutsummaryrefslogtreecommitdiff
path: root/test/test-database.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-08-09 21:00:37 -0400
committerGitHub <noreply@github.com>2020-08-09 21:00:37 -0400
commit7b1838a282f4ac5c50e0ea36122751c3454266aa (patch)
tree1fb73929e4ce6ae23842027f45d305335632c351 /test/test-database.js
parent486d44f7197a2dedc5ea487345e598c668d47638 (diff)
Create dev utility class for some shared functionality (#724)
Diffstat (limited to 'test/test-database.js')
-rw-r--r--test/test-database.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/test/test-database.js b/test/test-database.js
index e8fb07b3..84fa8afb 100644
--- a/test/test-database.js
+++ b/test/test-database.js
@@ -19,7 +19,8 @@ const fs = require('fs');
const url = require('url');
const path = require('path');
const assert = require('assert');
-const yomichanTest = require('./yomichan-test');
+const {JSZip} = require('../dev/yomichan-util');
+const {createTestDictionaryArchive} = require('./yomichan-test');
const {VM} = require('./yomichan-vm');
require('fake-indexeddb/auto');
@@ -104,7 +105,7 @@ const vm = new VM({
fetch,
indexedDB: global.indexedDB,
IDBKeyRange: global.IDBKeyRange,
- JSZip: yomichanTest.JSZip,
+ JSZip,
addEventListener() {
// NOP
}
@@ -169,7 +170,7 @@ function clearDatabase(timeout) {
async function testDatabase1() {
// Load dictionary data
- const testDictionary = yomichanTest.createTestDictionaryArchive('valid-dictionary1');
+ const testDictionary = createTestDictionaryArchive('valid-dictionary1');
const testDictionarySource = await testDictionary.generateAsync({type: 'string'});
const testDictionaryIndex = JSON.parse(await testDictionary.files['index.json'].async('string'));
@@ -853,7 +854,7 @@ async function testFindTagForTitle1(database, title) {
async function testDatabase2() {
// Load dictionary data
- const testDictionary = yomichanTest.createTestDictionaryArchive('valid-dictionary1');
+ const testDictionary = createTestDictionaryArchive('valid-dictionary1');
const testDictionarySource = await testDictionary.generateAsync({type: 'string'});
const testDictionaryIndex = JSON.parse(await testDictionary.files['index.json'].async('string'));
@@ -910,7 +911,7 @@ async function testDatabase3() {
await dictionaryDatabase.prepare();
for (const invalidDictionary of invalidDictionaries) {
- const testDictionary = yomichanTest.createTestDictionaryArchive(invalidDictionary);
+ const testDictionary = createTestDictionaryArchive(invalidDictionary);
const testDictionarySource = await testDictionary.generateAsync({type: 'string'});
let error = null;