-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtools2.schema.test.js
More file actions
36 lines (28 loc) · 1.27 KB
/
tools2.schema.test.js
File metadata and controls
36 lines (28 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
const path = require('path');
const fs = require('fs');
const toolSchema = require('../schemas/tool.schema');
let { test, expect ,it, describe} = global;
describe('Automatic Suite for testing all tools in examples folder', () => {
const directoryPath = path.join(__dirname, '../examples/tool');
const files = fs.readdirSync(directoryPath, function (err, files) { if (err) return []; });
files.forEach(file=> {
if (file.includes(".json")){
test(`checks for ${file}`, () => {
expect(true).toBeAjvValid(toolSchema,require( "../examples/tool/"+file.split(".json")[0]).miniWorkflow.currentTool);
});
}
});
});
describe('Automatic Suite for testing all tools in remote location folder', () => {
const globalPath = "c:\\PATH"; // PUT YOUR LOCAL FOLDER HERE
const files = fs.readdirSync(globalPath, function (err, files) { if (err) return []; });
files.forEach(file=> {
if (file.includes(".json")){
const jsonObject = require( globalPath+file.split(".json")[0]);
if (jsonObject!=null && jsonObject.miniWorkflow!=null && jsonObject.miniWorkflow.currentTool!=null)
test(`checks for ${file}`, () => {
expect(true).toBeAjvValid(toolSchema,jsonObject.miniWorkflow.currentTool);
});
}
});
});