Browse Source

Add failing test case for one postcode deduping

pull/1222/head
Julian Simioni 6 years ago
parent
commit
a31f1a8561
No known key found for this signature in database
GPG Key ID: B9EEB0C6EE0910A1
  1. 19
      test/unit/middleware/dedupe.js

19
test/unit/middleware/dedupe.js

@ -1,6 +1,7 @@
var data = require('../fixture/dedupe_elasticsearch_results'); var data = require('../fixture/dedupe_elasticsearch_results');
var nonAsciiData = require('../fixture/dedupe_elasticsearch_nonascii_results'); var nonAsciiData = require('../fixture/dedupe_elasticsearch_nonascii_results');
var customLayerData = require('../fixture/dedupe_elasticsearch_custom_layer_results'); var customLayerData = require('../fixture/dedupe_elasticsearch_custom_layer_results');
var onlyPostalcodeDiffers = require('../fixture/dedupe_only_postalcode_differs');
var dedupe = require('../../../middleware/dedupe')(); var dedupe = require('../../../middleware/dedupe')();
module.exports.tests = {}; module.exports.tests = {};
@ -75,6 +76,24 @@ module.exports.tests.dedupe = function(test, common) {
t.end(); t.end();
}); });
}); });
test('test records with no address except one has postalcode', function(t) {
var req = {
clean: {
size: 20
}
};
var res = {
data: onlyPostalcodeDiffers
};
var expected = onlyPostalcodeDiffers[1]; // non-canonical record
dedupe(req, res, function () {
t.equal(res.data.length, 1, 'only one result displayed');
t.equal(res.data[0], expected, 'record with postalcode is preferred');
t.end();
});
});
}; };

Loading…
Cancel
Save