Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
test(testCase.path, function() {
// Load test data
var filePath = testCase.path;
// Prefix with basePath if a basePath is given
if (options.basePath) {
filePath = path.join(options.basePath, filePath);
}
var data = fs.readFileSync(filePath, {encoding: 'utf-8'});
var json = JSON.parse(data);
// Find schema
var schema = libUrls.schema(libUrls.testRootUrl(), options.serviceName, testCase.schema);
// Validate json
var error = validate(json, schema);
// Test errors
if (testCase.success) {
if (error !== null) {
debug('Errors: %j', error);
}
assert(error === null,
'Schema doesn\'t match test for ' + testCase.path);
} else {
assert(error !== null,
'Schema matches unexpectedly test for ' + testCase.path);
}
});
setup(async function() {
const schemaset = new SchemaSet(options.schemasetOptions);
validate = await schemaset.validator(libUrls.testRootUrl());
});
constructor() {
super({credentials: {}, rootUrl: libUrls.testRootUrl()});
this.shouldFail = false;
this.shouldNotProduceTask = false;
this.fireCalls = [];
}