Test array behaviour at model level

pull/2/head
Louis Chatriot 12 years ago
parent 11e2510d9a
commit a454e3d4ac
  1. 8
      test/model.test.js

@ -325,7 +325,7 @@ describe('Model', function () {
}); // ==== End of 'Modifying documents' ==== // }); // ==== End of 'Modifying documents' ==== //
describe('Finding documents', function () { describe('Querying', function () {
describe('Comparing things', function () { describe('Comparing things', function () {
@ -412,6 +412,12 @@ describe('Model', function () {
model.match({ test: { pp: undefined } }, { "test.pp": undefined }).should.equal(false); model.match({ test: { pp: undefined } }, { "test.pp": undefined }).should.equal(false);
}); });
it('For field array, a match means a match on at least one element', function () {
model.match({ tags: ['node', 'js', 'db'] }, { tags: 'python' }).should.equal(false);
model.match({ tags: ['node', 'js', 'db'] }, { tags: 'js' }).should.equal(true);
model.match({ tags: ['node', 'js', 'db'] }, { tags: 'js', tags: 'node' }).should.equal(true);
});
}); });
}); // ==== End of 'Finding documents' ==== // }); // ==== End of 'Finding documents' ==== //

Loading…
Cancel
Save