diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/test-database.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/test/test-database.js b/test/test-database.js index 19ac49e2..ac7e825b 100644 --- a/test/test-database.js +++ b/test/test-database.js @@ -18,7 +18,7 @@ const path = require('path'); const assert = require('assert'); const {createDictionaryArchive, testMain} = require('../dev/util'); -const {DatabaseVM} = require('../dev/database-vm'); +const {DatabaseVM, DatabaseVMDictionaryImporterMediaLoader} = require('../dev/database-vm'); const vm = new DatabaseVM(); @@ -41,6 +41,12 @@ function createTestDictionaryArchive(dictionary, dictionaryName) { } +function createDictionaryImporter() { + const dictionaryImporterMediaLoader = new DatabaseVMDictionaryImporterMediaLoader(); + return new DictionaryImporter(dictionaryImporterMediaLoader); +} + + function countDictionaryDatabaseEntriesWithTerm(dictionaryDatabaseEntries, term) { return dictionaryDatabaseEntries.reduce((i, v) => (i + (v.term === term ? 1 : 0)), 0); } @@ -125,7 +131,7 @@ async function testDatabase1() { ]; // Setup database - const dictionaryImporter = new DictionaryImporter(); + const dictionaryImporter = createDictionaryImporter(); const dictionaryDatabase = new DictionaryDatabase(); await dictionaryDatabase.prepare(); @@ -775,7 +781,7 @@ async function testDatabase2() { ]); // Setup database - const dictionaryImporter = new DictionaryImporter(); + const dictionaryImporter = createDictionaryImporter(); const dictionaryDatabase = new DictionaryDatabase(); // Error: not prepared @@ -817,7 +823,7 @@ async function testDatabase3() { ]; // Setup database - const dictionaryImporter = new DictionaryImporter(); + const dictionaryImporter = createDictionaryImporter(); const dictionaryDatabase = new DictionaryDatabase(); await dictionaryDatabase.prepare(); |