Skip to content

Commit

Permalink
run shared test from juggler for v3 and v4
Browse files Browse the repository at this point in the history
  • Loading branch information
Agnes Lin committed Feb 13, 2020
1 parent 8cd9910 commit 46a54db
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 30 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/node_modules/
13 changes: 6 additions & 7 deletions deps/juggler-v3/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{
"name": "juggler-v3",
"version": "3.0.0",
"dependencies": {
"loopback-datasource-juggler": "3.x",
"should": "^8.4.0"
}
"name": "juggler-v3",
"version": "3.0.0",
"dependencies": {
"loopback-datasource-juggler": "3.x",
"should": "^13.2.3"
}
}
14 changes: 8 additions & 6 deletions deps/juggler-v3/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT

"use strict";
'use strict';

const should = require('should');
const juggler = require("loopback-datasource-juggler");
const juggler = require('loopback-datasource-juggler');

require("../../test/init");
require('../../test/init');

describe("dashdb imported feature v3", function() {
describe('dashdb imported feature v3', function() {
before(function() {
return global.resetDataSourceClass(juggler.DataSource);
});
Expand All @@ -19,12 +19,14 @@ describe("dashdb imported feature v3", function() {
return global.resetDataSourceClass();
});

require("loopback-datasource-juggler/test/common.batch.js");
require("loopback-datasource-juggler/test/include.test.js");
require('loopback-datasource-juggler/test/common.batch.js');
require('loopback-datasource-juggler/test/include.test.js');

/* TODO: run persistence-hooks test suite too
const suite = require("loopback-datasource-juggler/test/persistence-hooks.suite.js");
const customConfig = Object.assign({}, global.config);
suite(global.getDataSource(customConfig, juggler.DataSource), should, {
replaceOrCreateReportsNewInstance: false
});
*/
});
13 changes: 6 additions & 7 deletions deps/juggler-v4/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{
"name": "juggler-v4",
"version": "4.0.0",
"dependencies": {
"loopback-datasource-juggler": "4.x",
"should": "^13.2.3"
}
"name": "juggler-v4",
"version": "4.0.0",
"dependencies": {
"loopback-datasource-juggler": "4.x",
"should": "^13.2.3"
}
}
14 changes: 8 additions & 6 deletions deps/juggler-v4/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT

"use strict";
'use strict';

const should = require('should');
const juggler = require("loopback-datasource-juggler");
const juggler = require('loopback-datasource-juggler');

require("../../test/init");
require('../../test/init');

describe("dashdb imported feature v4", function() {
describe('dashdb imported feature v4', function() {
before(function() {
return global.resetDataSourceClass(juggler.DataSource);
});
Expand All @@ -19,12 +19,14 @@ describe("dashdb imported feature v4", function() {
return global.resetDataSourceClass();
});

require("loopback-datasource-juggler/test/common.batch.js");
require("loopback-datasource-juggler/test/include.test.js");
require('loopback-datasource-juggler/test/common.batch.js');
require('loopback-datasource-juggler/test/include.test.js');

/* TODO: run persistence-hooks test suite too
const suite = require("loopback-datasource-juggler/test/persistence-hooks.suite.js");
const customConfig = Object.assign({}, global.config);
suite(global.getDataSource(customConfig, juggler.DataSource), should, {
replaceOrCreateReportsNewInstance: false
});
*/
});
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"lint": "eslint .",
"lint:fix": "eslint --fix .",
"pretest": "node pretest.js",
"test": "mocha --timeout 20000 --require test/init.js test/*.test.js node_modules/juggler-v3/test.js node_modules/juggler-v4/test.js",
"test": "mocha --timeout 60000 --require test/init.js test/*.test.js node_modules/juggler-v3/test.js node_modules/juggler-v4/test.js",
"posttest": "npm run lint"
},
"dependencies": {
Expand All @@ -30,7 +30,7 @@
},
"devDependencies": {
"bluebird": "^3.5.1",
"eslint": "^6.1.0",
"eslint": "^6.8.0",
"eslint-config-loopback": "^13.1.0",
"juggler-v3": "file:./deps/juggler-v3",
"juggler-v4": "file:./deps/juggler-v4",
Expand Down
4 changes: 2 additions & 2 deletions test/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@

module.exports = require('should');

const Connector = require('../');
const juggler = require('loopback-datasource-juggler');
let DataSource = juggler.DataSource;

let schemaName;
let schemaName, db;

/** these are the env variables in jenkins **/
if (process.env.CI && process.env.PACKAGE_NAME &&
Expand All @@ -35,7 +36,6 @@ const config = {

global.config = config;

let db;
global.getDataSource = global.getSchema = function(options) {
db = new DataSource(Connector, global.config);
db.log = function(a) {
Expand Down

0 comments on commit 46a54db

Please sign in to comment.