Added a test case for neq

This commit is contained in:
Raymond Feng 2014-09-02 08:36:37 -07:00
parent e9f00fbd8b
commit 6020436063
2 changed files with 15 additions and 2 deletions

View File

@ -409,6 +409,7 @@ function applyFilter(filter) {
if (example === undefined) { if (example === undefined) {
return undefined; return undefined;
} }
if (typeof example === 'object') { if (typeof example === 'object') {
// ignore geo near filter // ignore geo near filter
if (example.near) { if (example.near) {
@ -425,7 +426,7 @@ function applyFilter(filter) {
return false; return false;
} }
if (example.neq) { if ('neq' in example) {
return compare(example.neq, value) !== 0; return compare(example.neq, value) !== 0;
} }
@ -449,7 +450,8 @@ function applyFilter(filter) {
} }
} }
// not strict equality // not strict equality
return (example !== null ? example.toString() : example) == (value != null ? value.toString() : value); return (example !== null ? example.toString() : example)
== (value != null ? value.toString() : value);
} }
/** /**

View File

@ -223,6 +223,17 @@ describe('Memory connector', function () {
}); });
}); });
it('should support neq operator for null', function (done) {
User.find({where: {role: {neq: null}}}, function (err, users) {
should.not.exist(err);
users.length.should.be.equal(2);
for (var i = 0; i < users.length; i++) {
should.exist(users[i].role);
}
done();
});
});
function seed(done) { function seed(done) {
var beatles = [ var beatles = [
{ {