Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add test for deepEquals on document arrays

  • Loading branch information...
commit f57e2413c86f4c548d580a8ef414f65286c437ea 1 parent b127436
@aheckmann aheckmann authored
Showing with 24 additions and 5 deletions.
  1. +24 −5 test/utils.test.js
View
29 test/utils.test.js
@@ -3,9 +3,10 @@
* Module dependencies.
*/
-require('./common');
-
-var utils = require('../lib/utils')
+var start = require('./common')
+ , mongoose = start.mongoose
+ , Schema = mongoose.Schema
+ , utils = require('../lib/utils')
, StateMachine = require('../lib/statemachine')
, ObjectId = require('../lib/types/objectid')
@@ -32,7 +33,7 @@ module.exports = {
ar.init('hello');
ar.stateOf('hello').should.equal('init');
},
-
+
'should detect a path as modified': function () {
var ar = new ActiveRoster();
ar.modify('hello');
@@ -47,7 +48,6 @@ module.exports = {
ar.states.modify.should.have.property('hello');
},
-
'forEach should be able to iterate through the paths belonging to one state': function () {
var ar = new ActiveRoster();
ar.init('hello');
@@ -147,6 +147,25 @@ module.exports = {
utils.deepEqual(a, b).should.be.true;
utils.deepEqual(a, a).should.be.true;
utils.deepEqual(a, new ObjectId).should.be.false;
+ },
+
+ 'deepEquals on MongooseDocumentArray works': function () {
+ var db = start()
+ , A = new Schema({ a: String })
+ , M = db.model('deepEqualsOnMongooseDocArray', new Schema({
+ a1: [A]
+ , a2: [A]
+ }));
+
+ db.close();
+
+ var m = new M({
+ a1: [{a: 'Hi'}, {a: 'Bye'}]
+ });
+
+ m.a2 = m.a1;
+
+ utils.deepEqual(m.a1, m.a2).should.be.true;
}
};
Please sign in to comment.
Something went wrong with that request. Please try again.