<commit_before>/* jshint node: true */
/* global describe, it, expect, jasmine */
'use strict';

var jsonDiff = require('../jsonDiff.js');

describe("no difference", function() {
    describe("primitive data types", function() {
        it("finds nothing at first level", function() {
            var one = { one: 1 };
            var two = { one: 1 };
            expect(jsonDiff(one, two)).toEqual([]);
        });
        
        it("finds nothing at later levels", function() {
            var one = { one: 1, two: { secondone: 1 }, three: { secondone: { thirdone: 1 } } };
            var two = { one: 1, two: { secondone: 1 }, three: { secondone: { thirdone: 1 } } };
            expect(jsonDiff(one, two)).toEqual([]);
        });
    });
});

describe("additions", function() {
	describe("primitive data types", function() {
		describe("first level", function() {
			it("one addition", function() {
				var one = { one: 1 };
				var two = { one: 1, two: 2 };
				expect(jsonDiff(one, two)).toEqual([{ at: "two", wasAdded: 2}]);
			});
			
			it("many additions", function() {
				var one = { one: 1 };
				var two = { one: 1, two: 2, three: 3 };
				expect(jsonDiff(one,two)).toEqual([{ at: "two", wasAdded: 2 }, { at: "three", wasAdded: 3 }]);
			});
		});
		
		
		describe("deeper levels", function() {
			it("one addition", function() {
				var one = { one: { secondone: { thirdone: 1 } } };
				var two = { one: { secondone: { thirdone: 1, thirdtwo: 2 } } };
				expect(jsonDiff(one, two)).toEqual([{ at: "one.secondone.thirdtwo", wasAdded: 2}]);
			});
			
			it("many additions in same level", function() {
				var one = { one: { secondone: { thirdone: 1 } } };
				var two = { one: { secondone: { thirdone: 1, thirdtwo: 2, thirdthree: 3 } } };
				expect(jsonDiff(one,two)).toEqual([{ at: "one.secondone.thirdtwo", wasAdded: 2 }, { at: "one.secondone.thirdthree", wasAdded: 3 }]);
			});
		});
	});
	
    describe("objects", function() {
		describe("first level", function() {
			it("one addition at first level", function() {
				var one = { one: { secondone: 1 } };
				var two = { one: { secondone: 1 }, two: { secondone: 1 } };
				expect(jsonDiff(one, two)).toEqual([{ at: "two", wasAdded: { secondone: 1 }}]);
			});
			
			it("many additions at first level", function() {
				var one = { one: { secondone: 1 } };
				var two = { one: { secondone: 1 }, two: { secondone: 1 }, three: { secondone: 1 } };
				expect(jsonDiff(one,two)).toEqual([{ at: "two", wasAdded: { secondone: 1 } }, { at: "three", wasAdded: { secondone: 1 } }]);
			});
		});
    });
});



describe("removals", function() {
    describe("primitive data types", function() {
		describe("first level", function() {
			it("one removal at first level", function() {
				var one = { one: 1, two: 2 };
				var two = { one: 1 };
				expect(jsonDiff(one, two)).toEqual([{ at: "two", wasRemoved: 2}]);
			});
			
			it("many removal at first level", function() {
				var one = { one: 1, two: 2, three: 3 };
				var two = { one: 1 };
				expect(jsonDiff(one,two)).toEqual([{ at: "two", wasRemoved: 2 }, { at: "three", wasRemoved: 3 }]);
			});
		});
    });
	
	
    describe("objects", function() {
		describe("first level", function() {
			it("one removal at first level", function() {
				var one = { one: { secondone: 1 }, two: { secondone: 1 } };
				var two = { one: { secondone: 1 } };
				expect(jsonDiff(one, two)).toEqual([{ at: "two", wasRemoved: { secondone: 1 }}]);
			});
			
			it("many removals at first level", function() {
				var one = { one: { secondone: 1 }, two: { secondone: 1 }, three: { secondone: 1 } };
				var two = { one: { secondone: 1 } };
				expect(jsonDiff(one,two)).toEqual([{ at: "two", wasRemoved: { secondone: 1 } }, { at: "three", wasRemoved: { secondone: 1 } }]);
			});
		});
    });
});<commit_msg>Make the tests easier to read<commit_after>/* jshint node: true */
/* global describe, it, expect, jasmine */
'use strict';

var jsonDiff = require('../jsonDiff.js');

describe("no difference", function() {
	
	
	
    describe("primitive data types", function() {
		
		
        it("finds nothing at first level", function() {
            var one = { one: 1 };
            var two = { one: 1 };
            expect(jsonDiff(one, two)).toEqual([]);
        });
        
        it("finds nothing at later levels", function() {
            var one = { one: 1, two: { secondone: 1 }, three: { secondone: { thirdone: 1 } } };
            var two = { one: 1, two: { secondone: 1 }, three: { secondone: { thirdone: 1 } } };
            expect(jsonDiff(one, two)).toEqual([]);
        });
		
		
    });
	
	
	
});

describe("additions", function() {
	
	
	
	describe("primitive data types", function() {
		
		
		describe("first level", function() {
			
			it("one addition", function() {
				var one = { one: 1 };
				var two = { one: 1, two: 2 };
				expect(jsonDiff(one, two)).toEqual([{ at: "two", wasAdded: 2}]);
			});
			
			it("many additions", function() {
				var one = { one: 1 };
				var two = { one: 1, two: 2, three: 3 };
				expect(jsonDiff(one,two)).toEqual([{ at: "two", wasAdded: 2 }, { at: "three", wasAdded: 3 }]);
			});
			
		});
		
		
		describe("deeper levels", function() {
			
			it("one addition", function() {
				var one = { one: { secondone: { thirdone: 1 } } };
				var two = { one: { secondone: { thirdone: 1, thirdtwo: 2 } } };
				expect(jsonDiff(one, two)).toEqual([{ at: "one.secondone.thirdtwo", wasAdded: 2}]);
			});
			
			it("many additions in same level", function() {
				var one = { one: { secondone: { thirdone: 1 } } };
				var two = { one: { secondone: { thirdone: 1, thirdtwo: 2, thirdthree: 3 } } };
				expect(jsonDiff(one,two)).toEqual([{ at: "one.secondone.thirdtwo", wasAdded: 2 }, { at: "one.secondone.thirdthree", wasAdded: 3 }]);
			});
			
		});
		
		
	});
	
	
	
    describe("objects", function() {
		
		
		describe("first level", function() {
			
			it("one addition at first level", function() {
				var one = { one: { secondone: 1 } };
				var two = { one: { secondone: 1 }, two: { secondone: 1 } };
				expect(jsonDiff(one, two)).toEqual([{ at: "two", wasAdded: { secondone: 1 }}]);
			});
			
			it("many additions at first level", function() {
				var one = { one: { secondone: 1 } };
				var two = { one: { secondone: 1 }, two: { secondone: 1 }, three: { secondone: 1 } };
				expect(jsonDiff(one,two)).toEqual([{ at: "two", wasAdded: { secondone: 1 } }, { at: "three", wasAdded: { secondone: 1 } }]);
			});
			
		});
		
		
    });
	
	
	
});



describe("removals", function() {
	
	
	
    describe("primitive data types", function() {
		
		describe("first level", function() {
			
			it("one removal at first level", function() {
				var one = { one: 1, two: 2 };
				var two = { one: 1 };
				expect(jsonDiff(one, two)).toEqual([{ at: "two", wasRemoved: 2}]);
			});
			
			it("many removal at first level", function() {
				var one = { one: 1, two: 2, three: 3 };
				var two = { one: 1 };
				expect(jsonDiff(one,two)).toEqual([{ at: "two", wasRemoved: 2 }, { at: "three", wasRemoved: 3 }]);
			});
			
		});
		
    });
	
	
	
    describe("objects", function() {
		
		
		describe("first level", function() {
			
			it("one removal at first level", function() {
				var one = { one: { secondone: 1 }, two: { secondone: 1 } };
				var two = { one: { secondone: 1 } };
				expect(jsonDiff(one, two)).toEqual([{ at: "two", wasRemoved: { secondone: 1 }}]);
			});
			
			it("many removals at first level", function() {
				var one = { one: { secondone: 1 }, two: { secondone: 1 }, three: { secondone: 1 } };
				var two = { one: { secondone: 1 } };
				expect(jsonDiff(one,two)).toEqual([{ at: "two", wasRemoved: { secondone: 1 } }, { at: "three", wasRemoved: { secondone: 1 } }]);
			});
			
		});
		
		
    });
	
	
	
	
});
{'fraction_non_alphanumeric': 0.2016418676244228, 'fraction_numerical': 0.014879425346331451, 'mean_word_length': 2.702279202279202, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1319119', 'n_tokens_mistral': 3122, 'n_tokens_neox': 2572, 'n_words': 729}