From 7901a467217f311566e7a3bc83ceafa17909d511 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Wed, 19 Feb 2020 18:46:27 -0500 Subject: [PATCH] Validate results of importDictionary --- test/test-database.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/test/test-database.js b/test/test-database.js index b9ac8a46..d66e2137 100644 --- a/test/test-database.js +++ b/test/test-database.js @@ -83,26 +83,30 @@ async function testDatabase1() { await database.prepare(); for (const {cleanup} of iterations) { + const expectedSummary = { + title, + revision: 'test', + sequenced: true, + version: 3, + prefixWildcardsSupported: true + }; + // Import data let progressEvent = false; - await database.importDictionary( + const {result, errors} = await database.importDictionary( testDictionarySource, () => { progressEvent = true; }, {prefixWildcardsSupported: true} ); + assert.deepStrictEqual(errors, []); + assert.deepStrictEqual(result, expectedSummary); assert.ok(progressEvent); // Get info summary const info = await database.getDictionaryInfo(); - assert.deepStrictEqual(info, [{ - title, - revision: 'test', - sequenced: true, - version: 3, - prefixWildcardsSupported: true - }]); + assert.deepStrictEqual(info, [expectedSummary]); // Get counts const counts = await database.getDictionaryCounts(