Validate results of importDictionary

This commit is contained in:
toasted-nutbread 2020-02-19 18:46:27 -05:00
parent a31ac68574
commit 7901a46721

View File

@ -83,26 +83,30 @@ async function testDatabase1() {
await database.prepare(); await database.prepare();
for (const {cleanup} of iterations) { for (const {cleanup} of iterations) {
const expectedSummary = {
title,
revision: 'test',
sequenced: true,
version: 3,
prefixWildcardsSupported: true
};
// Import data // Import data
let progressEvent = false; let progressEvent = false;
await database.importDictionary( const {result, errors} = await database.importDictionary(
testDictionarySource, testDictionarySource,
() => { () => {
progressEvent = true; progressEvent = true;
}, },
{prefixWildcardsSupported: true} {prefixWildcardsSupported: true}
); );
assert.deepStrictEqual(errors, []);
assert.deepStrictEqual(result, expectedSummary);
assert.ok(progressEvent); assert.ok(progressEvent);
// Get info summary // Get info summary
const info = await database.getDictionaryInfo(); const info = await database.getDictionaryInfo();
assert.deepStrictEqual(info, [{ assert.deepStrictEqual(info, [expectedSummary]);
title,
revision: 'test',
sequenced: true,
version: 3,
prefixWildcardsSupported: true
}]);
// Get counts // Get counts
const counts = await database.getDictionaryCounts( const counts = await database.getDictionaryCounts(