@dhyasama/totem-models 5.7.1 → 5.8.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/.npmignore +14 -0
- package/lib/Message.js +9 -2
- package/lib/Person.js +7 -1
- package/package-lock.json +1854 -0
- package/package.json +1 -1
- package/test/Message.js +25 -0
- package/test/Person.js +39 -0
package/package.json
CHANGED
package/test/Message.js
CHANGED
|
@@ -50,8 +50,13 @@ describe('Message', function() {
|
|
|
50
50
|
Message.upsert(message, function(err, result) {
|
|
51
51
|
should.not.exist(err);
|
|
52
52
|
should.exist(result);
|
|
53
|
+
|
|
54
|
+
result.createdOn.should.equal(result.updatedOn);
|
|
55
|
+
|
|
53
56
|
messageOne = result;
|
|
57
|
+
|
|
54
58
|
done();
|
|
59
|
+
|
|
55
60
|
});
|
|
56
61
|
|
|
57
62
|
});
|
|
@@ -303,4 +308,24 @@ describe('Message', function() {
|
|
|
303
308
|
|
|
304
309
|
});
|
|
305
310
|
|
|
311
|
+
it('updates a message', function(done) {
|
|
312
|
+
|
|
313
|
+
var orgid = new mongoose.Types.ObjectId();
|
|
314
|
+
|
|
315
|
+
messageOne.organization = orgid;
|
|
316
|
+
|
|
317
|
+
Message.upsert(messageOne, function(err, result) {
|
|
318
|
+
|
|
319
|
+
should.not.exist(err);
|
|
320
|
+
should.exist(result);
|
|
321
|
+
|
|
322
|
+
result.organization.should.equal(orgid);
|
|
323
|
+
result.createdOn.should.not.equal(result.updatedOn);
|
|
324
|
+
|
|
325
|
+
return done();
|
|
326
|
+
|
|
327
|
+
});
|
|
328
|
+
|
|
329
|
+
});
|
|
330
|
+
|
|
306
331
|
});
|
package/test/Person.js
CHANGED
|
@@ -515,6 +515,45 @@ describe('Person', function() {
|
|
|
515
515
|
|
|
516
516
|
});
|
|
517
517
|
|
|
518
|
+
it('searches by email', function(done) {
|
|
519
|
+
|
|
520
|
+
Person.searchByEmail('dhyasama+test@gmail.com', function(err, result) {
|
|
521
|
+
|
|
522
|
+
should.not.exist(err);
|
|
523
|
+
should.exist(result);
|
|
524
|
+
result.length.should.equal(1);
|
|
525
|
+
done();
|
|
526
|
+
|
|
527
|
+
});
|
|
528
|
+
|
|
529
|
+
});
|
|
530
|
+
|
|
531
|
+
it('searches by empty string email', function(done) {
|
|
532
|
+
|
|
533
|
+
Person.searchByEmail('', function(err, result) {
|
|
534
|
+
|
|
535
|
+
should.exist(err);
|
|
536
|
+
should.not.exist(result);
|
|
537
|
+
|
|
538
|
+
done();
|
|
539
|
+
|
|
540
|
+
});
|
|
541
|
+
|
|
542
|
+
});
|
|
543
|
+
|
|
544
|
+
it('searches by null email', function(done) {
|
|
545
|
+
|
|
546
|
+
Person.searchByEmail(null, function(err, result) {
|
|
547
|
+
|
|
548
|
+
should.exist(err);
|
|
549
|
+
should.not.exist(result);
|
|
550
|
+
|
|
551
|
+
done();
|
|
552
|
+
|
|
553
|
+
});
|
|
554
|
+
|
|
555
|
+
});
|
|
556
|
+
|
|
518
557
|
});
|
|
519
558
|
|
|
520
559
|
it('finds dupes with separate first and last search', function(done) {
|