aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-05-06 19:28:26 -0400
committerGitHub <noreply@github.com>2020-05-06 19:28:26 -0400
commit021ccb5ac3038f63d07ccc9575ee56480031a251 (patch)
tree2d83181aed20494c5c73943dc878f06bb89bb211 /test
parent501281e887fb66b490f90e7593639112b058ab97 (diff)
Move util database modification functions (#499)
* Update onProgress callback to handle multiple arguments * Add apiImportDictionaryArchive * Add apiDeleteDictionary * Make onProgress the last argument for consistency * Remove deprecated util functions * Fix issue with missing progress args * Remove function calls which modify the database from Translator * Update tests * Fix errors not being serialized correctly in _createActionListenerPort
Diffstat (limited to 'test')
-rw-r--r--test/test-database.js18
1 files changed, 9 insertions, 9 deletions
diff --git a/test/test-database.js b/test/test-database.js
index 3684051b..e8a4a343 100644
--- a/test/test-database.js
+++ b/test/test-database.js
@@ -233,10 +233,10 @@ async function testDatabase1() {
let progressEvent = false;
await database.deleteDictionary(
title,
+ {rate: 1000},
() => {
progressEvent = true;
- },
- {rate: 1000}
+ }
);
assert.ok(progressEvent);
@@ -267,10 +267,10 @@ async function testDatabase1() {
const {result, errors} = await dictionaryImporter.import(
database,
testDictionarySource,
+ {prefixWildcardsSupported: true},
() => {
progressEvent = true;
- },
- {prefixWildcardsSupported: true}
+ }
);
vm.assert.deepStrictEqual(errors, []);
vm.assert.deepStrictEqual(result, expectedSummary);
@@ -908,7 +908,7 @@ async function testDatabase2() {
// Error: not prepared
await assert.rejects(async () => await database.purge());
- await assert.rejects(async () => await database.deleteDictionary(title, () => {}, {}));
+ await assert.rejects(async () => await database.deleteDictionary(title, {}, () => {}));
await assert.rejects(async () => await database.findTermsBulk(['?'], titles, null));
await assert.rejects(async () => await database.findTermsExactBulk(['?'], ['?'], titles));
await assert.rejects(async () => await database.findTermsBySequenceBulk([1], title));
@@ -919,17 +919,17 @@ async function testDatabase2() {
await assert.rejects(async () => await database.findTagForTitle('tag', title));
await assert.rejects(async () => await database.getDictionaryInfo());
await assert.rejects(async () => await database.getDictionaryCounts(titles, true));
- await assert.rejects(async () => await dictionaryImporter.import(database, testDictionarySource, () => {}, {}));
+ await assert.rejects(async () => await dictionaryImporter.import(database, testDictionarySource, {}, () => {}));
await database.prepare();
// Error: already prepared
await assert.rejects(async () => await database.prepare());
- await dictionaryImporter.import(database, testDictionarySource, () => {}, {});
+ await dictionaryImporter.import(database, testDictionarySource, {}, () => {});
// Error: dictionary already imported
- await assert.rejects(async () => await dictionaryImporter.import(database, testDictionarySource, () => {}, {}));
+ await assert.rejects(async () => await dictionaryImporter.import(database, testDictionarySource, {}, () => {}));
await database.close();
}
@@ -956,7 +956,7 @@ async function testDatabase3() {
let error = null;
try {
- await dictionaryImporter.import(database, testDictionarySource, () => {}, {});
+ await dictionaryImporter.import(database, testDictionarySource, {}, () => {});
} catch (e) {
error = e;
}