forked from dawidd6/action-download-artifact
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_data.js
More file actions
42 lines (35 loc) · 1.01 KB
/
Copy pathtest_data.js
File metadata and controls
42 lines (35 loc) · 1.01 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
37
38
39
40
41
42
'use strict'
require('should')
var Dot = require('../index')
var testData = require('./data')
function singleTest (dot, input, expected) {
dot.object(input)
JSON.stringify(input).should.eql(JSON.stringify(expected))
}
describe('Test Data:', function () {
var dot = new Dot()
function testIt (test) {
it(test.name, function () {
if (test.options) {
Object.keys(test.options).forEach(function (name) {
dot[name] = test.options[name]
})
}
if (Array.isArray(test.input)) {
if (
!Array.isArray(test.expected) ||
test.input.length !== test.expected.length
) {
throw Error('Input and Expected tests length must be the same')
}
test.expected.forEach((expected, i) => {
singleTest(dot, test.input[i], expected)
})
} else {
singleTest(dot, test.input, test.expected)
}
})
}
// note with object() it is possible to cleanup, with del it is not.
testData.forEach(testIt)
})