corrade-nucleus-nucleons – Blame information for rev 26

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 describe('getNextIntegerKey', function() {
2 it('when provided with invalid objects then it returns 0', function() {
3 expect(getNextIntegerKey({})).toBe(0);
4 expect(getNextIntegerKey([])).toBe(0);
5 expect(getNextIntegerKey(null)).toBe(0);
6 expect(getNextIntegerKey(undefined)).toBe(0);
7 });
8  
9 it('when provided with an object with only numeric keys then it returns the next numeric key as integer', function() {
10 expect(getNextIntegerKey({ 1:'first', 2: 'second', 3: 'third' })).toBe(4);
11 });
12  
13 it('when provided with an object with mixed keys then it returns the next numeric key as integer', function() {
14 expect(getNextIntegerKey({ 1: 'first', 2: 'second', three: 'third' })).toBe(3);
15 expect(getNextIntegerKey({ 1: 'first', second: 'second', '3': 'third' })).toBe(4);
16 });
17 });