Skip to content

Commit

Permalink
Added unit tests specific to DateType where null (#1349)
Browse files Browse the repository at this point in the history
* Added unit test for DateType where null

* BDD for connectors w/o null support
  • Loading branch information
pastcompute authored and Sakib Hasan committed Apr 25, 2017
1 parent e9ff88f commit 238175b
Showing 1 changed file with 28 additions and 3 deletions.
31 changes: 28 additions & 3 deletions test/basic-querying.test.js
Expand Up @@ -334,6 +334,30 @@ describe('basic-querying', function() {
});
});

bdd.itIf(connectorCapabilities.nullDataValueExists !== false,
'should support where date "neq" null', function(done) {
User.find({where: {birthday: {'neq': null},
}}, function(err, users) {
should.not.exist(err);
should.exist(users);
users.should.have.property('length', 2);
users[0].name.should.equal('John Lennon');
users[1].name.should.equal('Paul McCartney');
done();
});
});

bdd.itIf(connectorCapabilities.nullDataValueExists !== false,
'should support where date is null', function(done) {
User.find({where: {birthday: null,
}}, function(err, users) {
should.not.exist(err);
should.exist(users);
users.should.have.property('length', 4);
done();
});
});

it('should support date "gte" that is satisfied', function(done) {
User.find({where: {birthday: {'gte': new Date('1980-12-08')},
}}, function(err, users) {
Expand Down Expand Up @@ -1227,13 +1251,14 @@ function seed(done) {
{
seq: 2,
name: 'George Harrison',
birthday: null,
order: 5,
vip: false,
addressLoc: {lat: 22.7, lng: -89.03},
},
{seq: 3, name: 'Ringo Starr', order: 6, vip: false},
{seq: 4, name: 'Pete Best', order: 4},
{seq: 5, name: 'Stuart Sutcliffe', order: 3, vip: true},
{seq: 3, name: 'Ringo Starr', order: 6, birthday: null, vip: false},
{seq: 4, name: 'Pete Best', order: 4, birthday: null},
{seq: 5, name: 'Stuart Sutcliffe', order: 3, birthday: null, vip: true},
];

async.series([
Expand Down

0 comments on commit 238175b

Please sign in to comment.