2016-04-01 22:25:16 +00:00
|
|
|
// Copyright IBM Corp. 2011,2016. All Rights Reserved.
|
|
|
|
// Node module: loopback-datasource-juggler
|
|
|
|
// This file is licensed under the MIT License.
|
|
|
|
// License text available at https://opensource.org/licenses/MIT
|
|
|
|
|
2016-04-01 13:23:42 +00:00
|
|
|
/* eslint-disable camelcase */
|
|
|
|
|
2013-08-15 21:10:13 +00:00
|
|
|
/*
|
2014-01-24 17:09:53 +00:00
|
|
|
if (!process.env.TRAVIS) {
|
|
|
|
var semicov = require('semicov');
|
|
|
|
semicov.init('lib', 'LoopbackData');
|
|
|
|
process.on('exit', semicov.report);
|
|
|
|
}
|
|
|
|
*/
|
2012-04-18 23:20:44 +00:00
|
|
|
|
2016-08-22 19:55:22 +00:00
|
|
|
'use strict';
|
|
|
|
|
2011-10-03 17:18:44 +00:00
|
|
|
var group_name = false, EXT_EXP;
|
2013-02-19 08:32:44 +00:00
|
|
|
function it(should, test_case) {
|
2014-01-24 17:09:53 +00:00
|
|
|
check_external_exports();
|
|
|
|
if (group_name) {
|
|
|
|
EXT_EXP[group_name][should] = test_case;
|
|
|
|
} else {
|
|
|
|
EXT_EXP[should] = test_case;
|
|
|
|
}
|
2011-10-03 17:18:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
global.it = it;
|
|
|
|
|
|
|
|
function context(name, tests) {
|
2014-01-24 17:09:53 +00:00
|
|
|
check_external_exports();
|
|
|
|
EXT_EXP[name] = {};
|
|
|
|
group_name = name;
|
|
|
|
tests({
|
2016-04-01 11:48:17 +00:00
|
|
|
before: function(f) {
|
2014-01-24 17:09:53 +00:00
|
|
|
it('setUp', f);
|
|
|
|
},
|
2016-04-01 11:48:17 +00:00
|
|
|
after: function(f) {
|
2014-01-24 17:09:53 +00:00
|
|
|
it('tearDown', f);
|
2016-04-01 11:48:17 +00:00
|
|
|
},
|
2014-01-24 17:09:53 +00:00
|
|
|
});
|
|
|
|
group_name = false;
|
2011-10-03 17:18:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
global.context = context;
|
|
|
|
|
2013-02-19 08:32:44 +00:00
|
|
|
exports.init = function init(external_exports) {
|
2014-01-24 17:09:53 +00:00
|
|
|
EXT_EXP = external_exports;
|
|
|
|
if (external_exports.done) {
|
|
|
|
external_exports.done();
|
|
|
|
}
|
2011-10-03 17:18:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
function check_external_exports() {
|
2014-01-24 17:09:53 +00:00
|
|
|
if (!EXT_EXP) throw new Error(
|
|
|
|
'Before run this, please ensure that ' +
|
2018-07-16 06:46:25 +00:00
|
|
|
'require("spec_helper").init(exports); called'
|
|
|
|
);
|
2011-10-03 17:18:44 +00:00
|
|
|
}
|
|
|
|
|