aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-07-31 12:30:31 -0400
committerGitHub <noreply@github.com>2021-07-31 12:30:31 -0400
commit00c5ae79833a641ccc5f7d31b6eea3e91db4cb71 (patch)
treee21cb14527e2bf6e74b36eeab75e994d52df37b6 /test
parent2d57d69b9ed3adf1241074f7eb29a588bec817a2 (diff)
DictionaryImporterMediaLoader (#1860)
* Rename param for consistency * Move media loading functionality into DictionaryImporterMediaLoader * Create test class for media loading * Remove unnecessary Blob/Image/URL functionality
Diffstat (limited to 'test')
-rw-r--r--test/test-database.js14
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();