@dhyasama/totem-models 6.25.1 → 6.26.2
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 +4 -4
- package/lib/Person.js +3 -3
- package/package.json +1 -1
- package/test/Organization.js +11 -2
- package/test/Person.js +11 -2
package/lib/Organization.js
CHANGED
|
@@ -1430,10 +1430,10 @@ module.exports = function(mongoose, config) {
|
|
|
1430
1430
|
self
|
|
1431
1431
|
.find({ $or:
|
|
1432
1432
|
[
|
|
1433
|
-
{ 'social.facebook': new RegExp('facebook.com/' + username, 'i') },
|
|
1434
|
-
{ 'social.linkedin': new RegExp('linkedin.com/company/' + username, 'i') },
|
|
1435
|
-
{ 'social.twitter': new RegExp('twitter.com/' + username, 'i') },
|
|
1436
|
-
{ 'crunchbase.url': new RegExp('crunchbase.com/organization/' + username, 'i') }
|
|
1433
|
+
{ 'social.facebook': new RegExp('facebook.com/' + username + '\/?$', 'i') },
|
|
1434
|
+
{ 'social.linkedin': new RegExp('linkedin.com/company/' + username + '\/?$', 'i') },
|
|
1435
|
+
{ 'social.twitter': new RegExp('twitter.com/' + username + '\/?$', 'i') },
|
|
1436
|
+
{ 'crunchbase.url': new RegExp('crunchbase.com/organization/' + username + '\/?$', 'i') }
|
|
1437
1437
|
],
|
|
1438
1438
|
'deleted': { $ne: true }
|
|
1439
1439
|
})
|
package/lib/Person.js
CHANGED
|
@@ -721,9 +721,9 @@ module.exports = function(mongoose, config) {
|
|
|
721
721
|
self
|
|
722
722
|
.find({ $or:
|
|
723
723
|
[
|
|
724
|
-
{ 'social.facebook': new RegExp('facebook.com/' + username, 'i') },
|
|
725
|
-
{ 'social.linkedin': new RegExp('linkedin.com/in/' + username, 'i') },
|
|
726
|
-
{ 'social.twitter': new RegExp('twitter.com/' + username, 'i') }
|
|
724
|
+
{ 'social.facebook': new RegExp('facebook.com/' + username + '$/?', 'i') },
|
|
725
|
+
{ 'social.linkedin': new RegExp('linkedin.com/in/' + username + '\/?$', 'i') },
|
|
726
|
+
{ 'social.twitter': new RegExp('twitter.com/' + username + '/?$', 'i') }
|
|
727
727
|
],
|
|
728
728
|
'deleted': { $ne: true }
|
|
729
729
|
})
|
package/package.json
CHANGED
package/test/Organization.js
CHANGED
|
@@ -76,8 +76,8 @@ describe('Organization', function() {
|
|
|
76
76
|
org2.crunchbase.uuid = 'abc';
|
|
77
77
|
org2.crunchbase.url = 'abc';
|
|
78
78
|
org2.social.facebook = 'https://facebook.com/abc';
|
|
79
|
-
org2.social.linkedin = 'http://www.linkedin.com/in/abc';
|
|
80
|
-
org2.social.twitter = 'twitter.com/abc';
|
|
79
|
+
org2.social.linkedin = 'http://www.linkedin.com/in/abc/';
|
|
80
|
+
org2.social.twitter = 'twitter.com/abc/';
|
|
81
81
|
org2.iLevel.push({
|
|
82
82
|
customer: new mongoose.Types.ObjectId(),
|
|
83
83
|
url: 'https://ilevel.com/test'
|
|
@@ -934,6 +934,15 @@ describe('Organization', function() {
|
|
|
934
934
|
});
|
|
935
935
|
});
|
|
936
936
|
|
|
937
|
+
it('will not match partial username', function (done) {
|
|
938
|
+
Organization.findBySocial('http://twitter.com/abcdef', function (err, result) {
|
|
939
|
+
should.not.exist(err);
|
|
940
|
+
should.exist(result);
|
|
941
|
+
result.length.should.equal(0);
|
|
942
|
+
return done();
|
|
943
|
+
});
|
|
944
|
+
});
|
|
945
|
+
|
|
937
946
|
it('finds orgs by twitter with https and no www', function (done) {
|
|
938
947
|
Organization.findBySocial('https://twitter.com/abc', function (err, result) {
|
|
939
948
|
should.not.exist(err);
|
package/test/Person.js
CHANGED
|
@@ -141,7 +141,7 @@ describe('Person', function() {
|
|
|
141
141
|
person3.aliases.push('Slippery Pete');
|
|
142
142
|
person3.social = {
|
|
143
143
|
facebook: 'facebook.com/slipperypete',
|
|
144
|
-
linkedin: 'http://www.linkedin.com/in/slipperypete',
|
|
144
|
+
linkedin: 'http://www.linkedin.com/in/slipperypete/',
|
|
145
145
|
twitter: 'https://twitter.com/slipperypete'
|
|
146
146
|
};
|
|
147
147
|
person3.contact.email.push({
|
|
@@ -690,6 +690,15 @@ describe('Person', function() {
|
|
|
690
690
|
});
|
|
691
691
|
});
|
|
692
692
|
|
|
693
|
+
it('will not match on partial username', function (done) {
|
|
694
|
+
Person.findBySocial('http://facebook.com/slipperypeterpumpkin', function (err, result) {
|
|
695
|
+
should.not.exist(err);
|
|
696
|
+
should.exist(result);
|
|
697
|
+
result.length.should.equal(0);
|
|
698
|
+
return done();
|
|
699
|
+
});
|
|
700
|
+
});
|
|
701
|
+
|
|
693
702
|
it('finds person by facebook with https and no www', function (done) {
|
|
694
703
|
Person.findBySocial('https://facebook.com/slipperypete', function (err, result) {
|
|
695
704
|
should.not.exist(err);
|
|
@@ -741,7 +750,7 @@ describe('Person', function() {
|
|
|
741
750
|
});
|
|
742
751
|
|
|
743
752
|
it('finds person by linkedin with http and no www', function (done) {
|
|
744
|
-
Person.findBySocial('http://linkedin.com/in/slipperypete', function (err, result) {
|
|
753
|
+
Person.findBySocial('http://linkedin.com/in/slipperypete?hello=world', function (err, result) {
|
|
745
754
|
should.not.exist(err);
|
|
746
755
|
should.exist(result);
|
|
747
756
|
result.length.should.equal(1);
|