aboutsummaryrefslogtreecommitdiff
path: root/test/test-database.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-06-21 16:12:56 -0400
committerGitHub <noreply@github.com>2020-06-21 16:12:56 -0400
commit244ab31bb2edb53ff7aecb51d2dd60b50a24c194 (patch)
treee274e1521b630d0b455b30e5968230020367ced0 /test/test-database.js
parente23504613f8526b90a497512c086ed48e66cde95 (diff)
Generic database (#600)
* Update test * Rename db to _db * Create GenericDatabase class * Catch prepare error * Allow database to be purged even if it was not open * Remove unused functions * Change static functions to non-static * Delete and count using the media object store * Update tests
Diffstat (limited to 'test/test-database.js')
-rw-r--r--test/test-database.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/test/test-database.js b/test/test-database.js
index 63989857..03b2bd3b 100644
--- a/test/test-database.js
+++ b/test/test-database.js
@@ -115,6 +115,7 @@ vm.execute([
'bg/js/media-utility.js',
'bg/js/request.js',
'bg/js/dictionary-importer.js',
+ 'bg/js/generic-database.js',
'bg/js/database.js'
]);
const DictionaryImporter = vm.get('DictionaryImporter');
@@ -242,8 +243,8 @@ async function testDatabase1() {
true
);
vm.assert.deepStrictEqual(counts, {
- counts: [{kanji: 2, kanjiMeta: 2, terms: 33, termMeta: 12, tagMeta: 14}],
- total: {kanji: 2, kanjiMeta: 2, terms: 33, termMeta: 12, tagMeta: 14}
+ counts: [{kanji: 2, kanjiMeta: 2, terms: 33, termMeta: 12, tagMeta: 14, media: 1}],
+ total: {kanji: 2, kanjiMeta: 2, terms: 33, termMeta: 12, tagMeta: 14, media: 1}
});
// Test find* functions
@@ -269,7 +270,7 @@ async function testDatabaseEmpty1(database) {
const counts = await database.getDictionaryCounts([], true);
vm.assert.deepStrictEqual(counts, {
counts: [],
- total: {kanji: 0, kanjiMeta: 0, terms: 0, termMeta: 0, tagMeta: 0}
+ total: {kanji: 0, kanjiMeta: 0, terms: 0, termMeta: 0, tagMeta: 0, media: 0}
});
}
@@ -863,8 +864,7 @@ async function testDatabase2() {
const database = new Database();
// 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, {rate: 1000}, () => {}));
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));