@dhyasama/totem-models 1.30.0 → 1.30.1
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.
- package/lib/Organization.js +8 -0
- package/package.json +1 -1
- package/test/Organization.js +1 -1
package/lib/Organization.js
CHANGED
|
@@ -1289,6 +1289,14 @@ module.exports = function(mongoose, config) {
|
|
|
1289
1289
|
});
|
|
1290
1290
|
}
|
|
1291
1291
|
|
|
1292
|
+
// Add website to website aliases
|
|
1293
|
+
// There are unique constraints on website and website aliases
|
|
1294
|
+
// This enables us to enforce uniqueness across both and across documents
|
|
1295
|
+
if (self.website && self.websiteAliases) {
|
|
1296
|
+
self.websiteAliases.push(self.website)
|
|
1297
|
+
self.websiteAliases = _.uniq(self.websiteAliases);
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1292
1300
|
};
|
|
1293
1301
|
|
|
1294
1302
|
cleanContactInfo();
|
package/package.json
CHANGED
package/test/Organization.js
CHANGED
|
@@ -844,7 +844,7 @@ describe('Organization', function() {
|
|
|
844
844
|
should.not.exist(err);
|
|
845
845
|
should.exist(result);
|
|
846
846
|
result.website.should.equal('www.yum.net');
|
|
847
|
-
result.websiteAliases.length.should.equal(
|
|
847
|
+
result.websiteAliases.length.should.equal(5); // the four aliases plus the primary
|
|
848
848
|
result.websiteAliases.indexOf('yum.co').should.not.equal(-1);
|
|
849
849
|
result.websiteAliases.indexOf('anglophile.co.uk').should.not.equal(-1);
|
|
850
850
|
result.websiteAliases.indexOf('abc.subdomain.com').should.not.equal(-1);
|