test(toJson): add extra test cases for new pretty behaviour

This commit is contained in:
Caitlin Potter
2014-12-02 15:39:08 -05:00
parent 1191edba4e
commit 7daf4e0125

View File

@@ -1189,11 +1189,17 @@ describe('angular', function() {
});
it('should format objects pretty', function() {
iit('should format objects pretty', function() {
expect(toJson({a: 1, b: 2}, true)).
toBeOneOf('{\n "a": 1,\n "b": 2\n}', '{\n "a":1,\n "b":2\n}');
toBe('{\n "a": 1,\n "b": 2\n}');
expect(toJson({a: {b: 2}}, true)).
toBeOneOf('{\n "a": {\n "b": 2\n }\n}', '{\n "a":{\n "b":2\n }\n}');
toBe('{\n "a": {\n "b": 2\n }\n}');
expect(toJson({a: 1, b: 2}, false)).
toBe('{"a":1,"b":2}');
expect(toJson({a: 1, b: 2}, 0)).
toBe('{"a":1,"b":2}');
expect(toJson({a: 1, b: 2}, 1)).
toBe('{\n "a": 1,\n "b": 2\n}');
});