commit
024f5e7937
|
@ -9,7 +9,7 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"pretest": "node pretest.js",
|
"pretest": "node pretest.js",
|
||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
"test": "mocha --timeout 10000 test/*.test.js node_modules/juggler-v3/test.js node_modules/juggler-v4/test.js",
|
"test": "mocha --timeout 10000 --exit test/*.test.js node_modules/juggler-v3/test.js node_modules/juggler-v4/test.js",
|
||||||
"posttest": "npm run lint"
|
"posttest": "npm run lint"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -27,7 +27,7 @@
|
||||||
"juggler-v3": "file:./deps/juggler-v3",
|
"juggler-v3": "file:./deps/juggler-v3",
|
||||||
"juggler-v4": "file:./deps/juggler-v4",
|
"juggler-v4": "file:./deps/juggler-v4",
|
||||||
"loopback-datasource-juggler": "^3.0.0 || ^4.0.0",
|
"loopback-datasource-juggler": "^3.0.0 || ^4.0.0",
|
||||||
"mocha": "^2.1.0",
|
"mocha": "^6.2.2",
|
||||||
"rc": "^1.0.0",
|
"rc": "^1.0.0",
|
||||||
"should": "^8.0.2",
|
"should": "^8.0.2",
|
||||||
"sinon": "^1.15.4"
|
"sinon": "^1.15.4"
|
||||||
|
|
|
@ -22,11 +22,13 @@ describe('MySQL specific datatypes', function() {
|
||||||
var dateForTransactions = [new Date(dateString1).toString(), new Date(dateString2).toString()];
|
var dateForTransactions = [new Date(dateString1).toString(), new Date(dateString2).toString()];
|
||||||
var data = [
|
var data = [
|
||||||
{
|
{
|
||||||
|
id: 1,
|
||||||
type: 'Student - Basic',
|
type: 'Student - Basic',
|
||||||
amount: 1000,
|
amount: 1000,
|
||||||
lastTransaction: dateString1,
|
lastTransaction: dateString1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
id: 2,
|
||||||
type: 'Professional',
|
type: 'Professional',
|
||||||
amount: 1999.99,
|
amount: 1999.99,
|
||||||
lastTransaction: dateString2,
|
lastTransaction: dateString2,
|
||||||
|
@ -51,7 +53,7 @@ describe('MySQL specific datatypes', function() {
|
||||||
dataType: 'DATE',
|
dataType: 'DATE',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
}, {forceId: false});
|
||||||
db.automigrate(done);
|
db.automigrate(done);
|
||||||
});
|
});
|
||||||
after(function(done) {
|
after(function(done) {
|
||||||
|
@ -86,7 +88,7 @@ describe('MySQL specific datatypes', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('find an instance', function(done) {
|
it('find an instance', function(done) {
|
||||||
Account.find(function(err, result) {
|
Account.find({order: 'amount'}, function(err, result) {
|
||||||
if (err) return done(err);
|
if (err) return done(err);
|
||||||
assert(result);
|
assert(result);
|
||||||
assert(_.isEqual(data.length, result.length));
|
assert(_.isEqual(data.length, result.length));
|
||||||
|
|
|
@ -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);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue