Fix dictionary import total progress (#1921)
* Fix incorrect total count for final step of dictionary import * Update tests to validate progress args
This commit is contained in:
parent
02194fcb9f
commit
1599ec1f15
@ -126,7 +126,7 @@ class DictionaryImporter {
|
||||
const {media} = await this._resolveAsyncRequirements(requirements, archive);
|
||||
|
||||
// Add dictionary descriptor
|
||||
this._progressNextStep(termList.length + termMetaList.length + kanjiList.length + kanjiMetaList.length + tagList.length);
|
||||
this._progressNextStep(termList.length + termMetaList.length + kanjiList.length + kanjiMetaList.length + tagList.length + media.length);
|
||||
|
||||
const summary = this._createSummary(dictionaryTitle, version, index, {prefixWildcardsSupported});
|
||||
dictionaryDatabase.bulkAdd('dictionaries', [summary], 0, 1);
|
||||
|
@ -43,7 +43,14 @@ function createTestDictionaryArchive(dictionary, dictionaryName) {
|
||||
|
||||
function createDictionaryImporter(onProgress) {
|
||||
const dictionaryImporterMediaLoader = new DatabaseVMDictionaryImporterMediaLoader();
|
||||
return new DictionaryImporter(dictionaryImporterMediaLoader, onProgress);
|
||||
return new DictionaryImporter(dictionaryImporterMediaLoader, (...args) => {
|
||||
const {stepIndex, stepCount, index, count} = args[0];
|
||||
assert.ok(stepIndex < stepCount);
|
||||
assert.ok(index <= count);
|
||||
if (typeof onProgress === 'function') {
|
||||
onProgress(...args);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user