update tests

This commit is contained in:
jannyHou 2019-11-05 15:46:10 -05:00
parent b46dbff5b1
commit 2c4591c23f
1 changed files with 5 additions and 12 deletions

View File

@ -46,7 +46,7 @@ describe('MySQL datetime handling', function() {
}); });
}); });
it('should allow use of DateStrings', function(done) { it('should allow use of DateStrings', () => {
var d = new DateString('1971-06-22'); var d = new DateString('1971-06-22');
return Person.create({ return Person.create({
name: 'Mr. Pink', name: 'Mr. Pink',
@ -58,9 +58,7 @@ describe('MySQL datetime handling', function() {
}).then(function(inst) { }).then(function(inst) {
inst.should.not.eql(null); inst.should.not.eql(null);
inst.dob.toString().should.eql(d.toString()); inst.dob.toString().should.eql(d.toString());
return done(); return;
}).catch(function(err) {
return done(err);
}); });
}); });
@ -72,7 +70,7 @@ describe('MySQL datetime handling', function() {
testDateTime(d, '+12:00', '1971-06-22 12:00:00'); testDateTime(d, '+12:00', '1971-06-22 12:00:00');
function testDateTime(date, tz, expected) { function testDateTime(date, tz, expected) {
it(tz, function(done) { it(tz, function() {
setConnectionTimezones(tz); setConnectionTimezones(tz);
db.settings.legacyUtcDateProcessing = false; db.settings.legacyUtcDateProcessing = false;
db.settings.timezone = tz; db.settings.timezone = tz;
@ -86,15 +84,12 @@ describe('MySQL datetime handling', function() {
}).then(function(inst) { }).then(function(inst) {
inst.should.not.eql(null); inst.should.not.eql(null);
inst.createdAt.toString().should.eql(expected); inst.createdAt.toString().should.eql(expected);
return done();
}).catch(function(err) {
return done(err);
}); });
}); });
} }
}); });
it('should allow use of fractional seconds', function(done) { it('should allow use of fractional seconds', function() {
var d = new Date('1971-06-22T12:34:56.789Z'); var d = new Date('1971-06-22T12:34:56.789Z');
return Person.create({ return Person.create({
name: 'Mr. Pink', name: 'Mr. Pink',
@ -106,9 +101,7 @@ describe('MySQL datetime handling', function() {
inst.should.not.eql(null); inst.should.not.eql(null);
var lastLogon = new Date(inst.lastLogon); var lastLogon = new Date(inst.lastLogon);
lastLogon.toJSON().should.eql(d.toJSON()); lastLogon.toJSON().should.eql(d.toJSON());
return done(); return;
}).catch(function(err) {
return done(err);
}); });
}); });
}); });