diff --git a/post/deduplication.js b/post/deduplication.js index aeb0793..06b3348 100644 --- a/post/deduplication.js +++ b/post/deduplication.js @@ -4,7 +4,7 @@ */ const _ = require('lodash'); -const prefixes = [ 'name', 'address_parts' ]; +const prefixes = [ 'name', 'phrase', 'address_parts' ]; function deduplication( doc ){ prefixes.forEach(prefix => { @@ -20,4 +20,4 @@ function deduplication( doc ){ }); } -module.exports = deduplication; \ No newline at end of file +module.exports = deduplication; diff --git a/test/post/deduplication.js b/test/post/deduplication.js index 056ebac..c3c089d 100644 --- a/test/post/deduplication.js +++ b/test/post/deduplication.js @@ -33,6 +33,21 @@ module.exports.tests.dedupe = function (test) { t.end(); }); + + test('dedupe - phrase', function (t) { + var doc = new Document('mysource', 'mylayer', 'myid'); + + doc.setNameAlias('default', 'test'); + doc.setName('default', 'test'); + doc.setNameAlias('default', 'test'); + doc.setNameAlias('default', 'test 2'); + doc.setNameAlias('default', 'test'); + + deduplication(doc); + t.deepEquals(doc.phrase.default, ['test', 'test 2']); + + t.end(); + }); }; module.exports.all = function (tape, common) {