forked from dawidd6/action-download-artifact
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuseArray.js
More file actions
68 lines (64 loc) · 1.85 KB
/
Copy pathuseArray.js
File metadata and controls
68 lines (64 loc) · 1.85 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
'use strict'
require('should')
var Dot = require('../index')
describe('useArray:', function () {
var dotObject, arrayObject, object
var arrayObjectExpected, objectExpected, dotObjectExpected
beforeEach(function () {
dotObject = {
'a.0': 'value'
}
dotObjectExpected = {
'a.0': 'value'
}
arrayObject = {
a: ['value']
}
arrayObjectExpected = {
a: ['value']
}
object = {
a: {
0: 'value'
}
}
objectExpected = {
a: {
0: 'value'
}
}
})
it('default is using array ', function () {
var dotLocal = require('../index')
arrayObjectExpected.should.eql(dotLocal.object(dotObject))
})
it('Should convert dot using arrays ', function () {
Dot.useArray = true
arrayObjectExpected.should.eql(Dot.object(dotObject))
})
it('Should convert dot not using arrays ', function () {
Dot.useArray = false
objectExpected.should.eql(Dot.object(dotObject))
})
it('Should convert object using arrays ', function () {
Dot.useArray = true
arrayObjectExpected.should.eql(Dot.object(dotObject))
})
it('Should convert dot using arrays and convert back equals source', function () {
Dot.useArray = true
Dot.useBrackets = false
dotObjectExpected.should.eql(Dot.dot(Dot.object(dotObject)))
})
it('Should convert object using arrays and convert back equals source', function () {
Dot.useArray = true
arrayObjectExpected.should.eql(Dot.object(Dot.dot(object)))
})
it('Should convert dot not using arrays and convert back equals source', function () {
Dot.useArray = false
dotObjectExpected.should.eql(Dot.dot(Dot.object(dotObject)))
})
it('Should convert object not using arrays and convert back equals source', function () {
Dot.useArray = false
objectExpected.should.eql(Dot.object(Dot.dot(arrayObject)))
})
})