Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Case insensitivity: added not and greaterThan tests #53

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 28 additions & 3 deletions interfaces/queryable/caseInsensitive.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,9 @@ describe('Queryable Interface', function() {
before(function(done) {

var usersArray = [
{ first_name: 'OTHER THINGS 0', type: 'case sensitivity' },
{ first_name: 'OTHER THINGS 1', type: 'case sensitivity' },
{ first_name: 'OTHER THINGS 0', type: 'case sensitivity gt' },
{ first_name: 'oTHER THINGS 1', type: 'case sensitivity gt' },
{ first_name: 'OTHER THINGS 2', type: 'case sensitivity gt' },
{ first_name: 'AR)H$daxx', type: 'case sensitivity' },
{ first_name: 'AR)H$daxxy', type: 'case sensitivity' },
{ first_name: '0n3 m0r3 est', type: 'case sensitivity' }
Expand Down Expand Up @@ -148,6 +149,30 @@ describe('Queryable Interface', function() {
done();
});
});

it('not should work in a case insensitive fashion by default', function(done) {
Queryable.User.find({ first_name: { not: 'THEtest', contains: 'Test' }, type: 'case sensitivity'}, function(err, users) {
assert(users);
assert.equal(users.length, 1);
assert.equal(users[0].first_name, 'tHeOtherTest');
done();
});
});

it('greaterThan should work in a case insensitive fashion by default', function(done) {
Queryable.User.find({ first_name: { greaterThan: 'oTHER THINGS 1'}, type: 'case sensitivity gt'}, function(err, users) {
assert(users);
assert.equal(users.length, 1);
assert.equal(users[0].first_name, 'OTHER THINGS 2');

Queryable.User.find({ first_name: { greaterThan: 'OTHER THINGS 0', lessThan: 'OTHER THINGS 2'}, type: 'case sensitivity gt'}, function(err, users) {
assert(users);
assert.equal(users.length, 1);
assert.equal(users[0].first_name, 'oTHER THINGS 1');
done();
});
});
});

});

Expand Down Expand Up @@ -191,6 +216,6 @@ describe('Queryable Interface', function() {
});
});
});

});
});