-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjsony_test.js
48 lines (38 loc) · 1.03 KB
/
jsony_test.js
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
describe("JSONY", function() {
testCases = [
{
string: "{ hello: \"world\" }",
object: { hello: "world" }
},
{
string: "{ age: 10, height: 120 }",
object: { age: 10, height: 120 }
},
{
string: "{ people: [\"Ann\", \"Alice\", \"Bob\"] }",
object: { people: ["Ann", "Alice", "Bob"] }
},
{
string: "{ config: { servers: [10, 15, 13], ngnix: { gate: 0, ip: \"127.0.0.1\" } } }",
object: {
config: {
servers: [10, 15, 13],
ngnix: {
gate : 0,
ip: "127.0.0.1"
}
}
}
}
];
function makeTest( currentCase ){
it("пример " + currentCase.string, function() {
var jsony = new JSONY();
var obj = { hello: "world" };
assert.deepEqual( jsony.parse(currentCase.string) , currentCase.object , ' is fine!' );
});
}
for( var i = 0 , testLength = testCases.length ; i < testLength ; i++ ){
makeTest( testCases[i] );
}
});