Skip to content

Commit

Permalink
Merge pull request #289 from pelias/deduplicate_bundle_list
Browse files Browse the repository at this point in the history
fix: deduplicate bundle list to avoid duplicate downloads
  • Loading branch information
orangejulius authored Sep 21, 2017
2 parents a9e1986 + 6b92d6d commit d4cad40
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/bundleList.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ function getBundleList(callback) {

}).on('close', () => {

const bundles = combineBundleBuckets(roles, bundleBuckets);
const bundles = _.sortedUniq(combineBundleBuckets(roles, bundleBuckets));

callback(null, bundles);

Expand Down
3 changes: 3 additions & 0 deletions test/bundleList.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const tape = require('tape');
const proxyquire = require('proxyquire');
const fs = require('fs-extra');
const _ = require('lodash');

proxyquire.noPreserveCache();
proxyquire.noCallThru();
Expand Down Expand Up @@ -137,6 +138,8 @@ tape('bundlesList tests', (test) => {
return found;
});

t.deepEquals(bundlesList, _.sortedUniq(bundlesList), 'no duplicates should exist in the bundle list');

unexpected.every((type) => {
const found = bundlesList.some((bundle) => {
return bundle.indexOf(type) !== -1;
Expand Down

0 comments on commit d4cad40

Please sign in to comment.