Added a test case for neq
This commit is contained in:
parent
e9f00fbd8b
commit
6020436063
|
@ -409,6 +409,7 @@ function applyFilter(filter) {
|
|||
if (example === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (typeof example === 'object') {
|
||||
// ignore geo near filter
|
||||
if (example.near) {
|
||||
|
@ -425,7 +426,7 @@ function applyFilter(filter) {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (example.neq) {
|
||||
if ('neq' in example) {
|
||||
return compare(example.neq, value) !== 0;
|
||||
}
|
||||
|
||||
|
@ -449,7 +450,8 @@ function applyFilter(filter) {
|
|||
}
|
||||
}
|
||||
// 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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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) {
|
||||
var beatles = [
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue