-
Notifications
You must be signed in to change notification settings - Fork 235
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #519 from strongloop/build/test-juggler-v3-and-v4
Run shared tests from both v3 and v4 of juggler
- Loading branch information
Showing
10 changed files
with
136 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
coverage | ||
**/node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"name": "juggler-v3", | ||
"version": "3.0.0", | ||
"dependencies": { | ||
"loopback-datasource-juggler":"3.x", | ||
"should": "^8.4.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Copyright IBM Corp. 2019. All Rights Reserved. | ||
// Node module: loopback-connector-postgresql | ||
// This file is licensed under the Artistic License 2.0. | ||
// License text available at https://opensource.org/licenses/Artistic-2.0 | ||
|
||
'use strict'; | ||
|
||
const semver = require('semver'); | ||
const should = require('should'); | ||
const juggler = require('loopback-datasource-juggler'); | ||
const name = require('./package.json').name; | ||
|
||
require('../../test/init'); | ||
|
||
describe(name, function() { | ||
before(function() { | ||
return global.resetDataSourceClass(juggler.DataSource); | ||
}); | ||
|
||
after(function() { | ||
return global.resetDataSourceClass(); | ||
}); | ||
|
||
require('loopback-datasource-juggler/test/common.batch.js'); | ||
require('loopback-datasource-juggler/test/default-scope.test.js'); | ||
require('loopback-datasource-juggler/test/include.test.js'); | ||
|
||
// === Operation hooks ==== // | ||
|
||
const suite = require('loopback-datasource-juggler/test/persistence-hooks.suite.js'); | ||
|
||
const DB_VERSION = process.env.MONGODB_VERSION; | ||
|
||
if (!DB_VERSION) { | ||
console.log('The ENV variable MONGODB_VERSION is not set.' + | ||
' Assuming MongoDB version 2.6 or newer.'); | ||
} | ||
|
||
const DB_HAS_2_6_FEATURES = (!DB_VERSION || | ||
semver.satisfies(DB_VERSION, '>=2.6.0')); | ||
|
||
const customConfig = Object.assign({}, global.config, { | ||
enableOptimisedFindOrCreate: DB_HAS_2_6_FEATURES, | ||
}); | ||
|
||
suite(global.getDataSource(customConfig, juggler.DataSource), should, { | ||
replaceOrCreateReportsNewInstance: DB_HAS_2_6_FEATURES, | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"name": "juggler-v4", | ||
"version": "4.0.0", | ||
"dependencies": { | ||
"loopback-datasource-juggler":"4.x", | ||
"should": "^13.2.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Copyright IBM Corp. 2019. All Rights Reserved. | ||
// Node module: loopback-connector-postgresql | ||
// This file is licensed under the Artistic License 2.0. | ||
// License text available at https://opensource.org/licenses/Artistic-2.0 | ||
|
||
'use strict'; | ||
|
||
const semver = require('semver'); | ||
const should = require('should'); | ||
const juggler = require('loopback-datasource-juggler'); | ||
const name = require('./package.json').name; | ||
|
||
require('../../test/init'); | ||
|
||
describe(name, function() { | ||
before(function() { | ||
return global.resetDataSourceClass(juggler.DataSource); | ||
}); | ||
|
||
after(function() { | ||
return global.resetDataSourceClass(); | ||
}); | ||
|
||
require('loopback-datasource-juggler/test/common.batch.js'); | ||
require('loopback-datasource-juggler/test/default-scope.test.js'); | ||
require('loopback-datasource-juggler/test/include.test.js'); | ||
|
||
// === Operation hooks ==== // | ||
|
||
const suite = require('loopback-datasource-juggler/test/persistence-hooks.suite.js'); | ||
|
||
const DB_VERSION = process.env.MONGODB_VERSION; | ||
|
||
if (!DB_VERSION) { | ||
console.log('The ENV variable MONGODB_VERSION is not set.' + | ||
' Assuming MongoDB version 2.6 or newer.'); | ||
} | ||
|
||
const DB_HAS_2_6_FEATURES = (!DB_VERSION || | ||
semver.satisfies(DB_VERSION, '>=2.6.0')); | ||
|
||
const customConfig = Object.assign({}, global.config, { | ||
enableOptimisedFindOrCreate: DB_HAS_2_6_FEATURES, | ||
}); | ||
|
||
suite(global.getDataSource(customConfig, juggler.DataSource), should, { | ||
replaceOrCreateReportsNewInstance: DB_HAS_2_6_FEATURES, | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.