From b46dbff5b1a398ad573831b79904799eb30f7385 Mon Sep 17 00:00:00 2001 From: jannyHou Date: Tue, 5 Nov 2019 11:17:07 -0500 Subject: [PATCH 1/4] upgrade dependencies --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 19d052d..dd9ee54 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "juggler-v3": "file:./deps/juggler-v3", "juggler-v4": "file:./deps/juggler-v4", "loopback-datasource-juggler": "^3.0.0 || ^4.0.0", - "mocha": "^2.1.0", + "mocha": "^6.2.2", "rc": "^1.0.0", "should": "^8.0.2", "sinon": "^1.15.4" From 2c4591c23ff5df17bcbcb2b6ca03b51ab9348aaa Mon Sep 17 00:00:00 2001 From: jannyHou Date: Tue, 5 Nov 2019 15:46:10 -0500 Subject: [PATCH 2/4] update tests --- test/datetime.test.js | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/test/datetime.test.js b/test/datetime.test.js index 9b5239e..251b5a6 100644 --- a/test/datetime.test.js +++ b/test/datetime.test.js @@ -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'); return Person.create({ name: 'Mr. Pink', @@ -58,9 +58,7 @@ describe('MySQL datetime handling', function() { }).then(function(inst) { inst.should.not.eql(null); inst.dob.toString().should.eql(d.toString()); - return done(); - }).catch(function(err) { - return done(err); + return; }); }); @@ -72,7 +70,7 @@ describe('MySQL datetime handling', function() { testDateTime(d, '+12:00', '1971-06-22 12:00:00'); function testDateTime(date, tz, expected) { - it(tz, function(done) { + it(tz, function() { setConnectionTimezones(tz); db.settings.legacyUtcDateProcessing = false; db.settings.timezone = tz; @@ -86,15 +84,12 @@ describe('MySQL datetime handling', function() { }).then(function(inst) { inst.should.not.eql(null); 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'); return Person.create({ name: 'Mr. Pink', @@ -106,9 +101,7 @@ describe('MySQL datetime handling', function() { inst.should.not.eql(null); var lastLogon = new Date(inst.lastLogon); lastLogon.toJSON().should.eql(d.toJSON()); - return done(); - }).catch(function(err) { - return done(err); + return; }); }); }); From 71df0be70be7461c70e6ea9dd3b5e1ddfb6e5bd1 Mon Sep 17 00:00:00 2001 From: jannyHou Date: Wed, 6 Nov 2019 15:19:49 -0500 Subject: [PATCH 3/4] fix: force exit --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index dd9ee54..29d838b 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "scripts": { "pretest": "node pretest.js", "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" }, "dependencies": { From 1617fc289e6ce99c92a58cf1b562d0c285779014 Mon Sep 17 00:00:00 2001 From: jannyHou Date: Wed, 6 Nov 2019 15:50:46 -0500 Subject: [PATCH 4/4] fix: tests for datatypes --- test/datatypes.test.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/datatypes.test.js b/test/datatypes.test.js index 155e671..baf48a8 100644 --- a/test/datatypes.test.js +++ b/test/datatypes.test.js @@ -22,11 +22,13 @@ describe('MySQL specific datatypes', function() { var dateForTransactions = [new Date(dateString1).toString(), new Date(dateString2).toString()]; var data = [ { + id: 1, type: 'Student - Basic', amount: 1000, lastTransaction: dateString1, }, { + id: 2, type: 'Professional', amount: 1999.99, lastTransaction: dateString2, @@ -51,7 +53,7 @@ describe('MySQL specific datatypes', function() { dataType: 'DATE', }, }, - }); + }, {forceId: false}); db.automigrate(done); }); after(function(done) { @@ -86,7 +88,7 @@ describe('MySQL specific datatypes', function() { }); it('find an instance', function(done) { - Account.find(function(err, result) { + Account.find({order: 'amount'}, function(err, result) { if (err) return done(err); assert(result); assert(_.isEqual(data.length, result.length));