@dhyasama/totem-merge 7.1.3 → 7.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,7 +7,7 @@ const { Types: { ObjectId } } = require('mongoose');
7
7
  // inactive tenant identities must remain protected too.
8
8
  module.exports = function customerMergeGuard(Organization, target, source, cb) {
9
9
  const blocked = () => new Error('Customer organizations cannot be merged');
10
- if ([target, source].some(org => org && org.customer && org.customer.totemUrl)) {
10
+ if ([target, source].some(org => org && org.customer && typeof org.customer.totemUrl === 'string')) {
11
11
  return cb(blocked(), null);
12
12
  }
13
13
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhyasama/totem-merge",
3
- "version": "7.1.3",
3
+ "version": "7.1.4",
4
4
  "description": "Org and person merging package",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -41,6 +41,11 @@ describe('customer organization merge guard', function() {
41
41
  assert.equal(f.calls.length, 0);
42
42
  });
43
43
  }
44
+ for (const side of ['target', 'source']) it('protects an explicit blank legacy URL on ' + side, async () => {
45
+ const f = fixture(); f[side].customer = { active: false, totemUrl: '' };
46
+ assert.match((await f.run()).message, /cannot be merged/);
47
+ assert.equal(f.calls.length, 0);
48
+ });
44
49
  it('also protects the organization reference if a Customer id is inconsistent', async function() {
45
50
  const f = fixture();
46
51
  f.records.push({ _id: new ObjectId(), organization: f.source._id });