1 |
|
2 | describe("Module <tolojson>", function() {
|
3 | it("is in the correct directory", function() {
|
4 | expect(function() {require("../lib/tolojson");}).not.toThrow();
|
5 | });
|
6 | describe("", function() {
|
7 | beforeAll(function() {
|
8 | this.T = require("../lib/tolojson");
|
9 | });
|
10 | it("adds indentation to its output", function() {
|
11 | [
|
12 | [
|
13 | {name:"Piliwik",age:27},
|
14 | '{"name": "Piliwik", "age": 27}'
|
15 | ],
|
16 | [
|
17 | {name:"Piliwik",age:27,temper:"Very friendly when IT sleeps!!"},
|
18 | '{\n "name": "Piliwik",\n "age": 27,\n "temper": "Very friendly when IT sleeps!!"\n}'
|
19 | ]
|
20 | ].forEach(
|
21 | function(testCase) {
|
22 | var result = this.T.stringify(testCase[0], ' ');
|
23 | expect(result).toBe(testCase[1]);
|
24 | },
|
25 | this
|
26 | );
|
27 | });
|
28 | });
|
29 | });
|