vsm-dictionary-cacher
Advanced tools
Comparing version 1.0.5 to 1.0.6
{ | ||
"name": "vsm-dictionary-cacher", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "Wrapper around a VSM-dictionary, that manages a cache of string-match results", | ||
@@ -5,0 +5,0 @@ "main": "src/VsmDictionaryCacher.js", |
@@ -108,4 +108,4 @@ /* | ||
if (this._getCacheMOEmptiesPrediction(str, options)) { | ||
return this.addExtraMatchesForString(str, { items: [] }, options, | ||
(err, res) => callAsync(cb, err, res) | ||
return this.addExtraMatchesForString(str, [], options, | ||
(err, arr) => callAsync(cb, err, { items: arr }) | ||
); | ||
@@ -112,0 +112,0 @@ } |
@@ -13,5 +13,6 @@ const cacher = require('./VsmDictionaryCacher'); | ||
var called; // This will be set to 1 if the stub getMatchesFor..() is called. | ||
var calledParent; // Is 1 if stub's parent's addExtraMatchesFor..() is called. | ||
var result; // The stub function will return this, whatever it is set to. | ||
// (See below). | ||
var calledParent; // Is 1 if stub's parent's addExtraMatchesFor..() is called. | ||
var arrGivenToParent; | ||
@@ -25,3 +26,7 @@ var clock; // See https://stackoverflow.com/questions/17446064 | ||
addExtraMatchesForString(str, arr, options, cb) { | ||
setTimeout( () => { calledParent = 1; cb(null, arr); }, 0 ); | ||
setTimeout( () => { | ||
calledParent = 1; | ||
arrGivenToParent = arr; | ||
cb(null, arr); | ||
}, 0); | ||
} | ||
@@ -70,2 +75,3 @@ }; | ||
calledParent = 0; | ||
arrGivenToParent = undefined; | ||
result = { items: ['default'] }; | ||
@@ -394,2 +400,4 @@ }); | ||
calledParent.should.equal(1); | ||
arrGivenToParent.should.deep.equal([]); // Parent gets OK data format. | ||
res.should.deep.equal(_R0); // Cacher integrates empty result OK. | ||
cb(); | ||
@@ -396,0 +404,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
37049
703