| Total Complexity | 5 |
| Complexity/F | 1 |
| Lines of Code | 68 |
| Function Count | 5 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import { Arr } from '../src/helpers'; |
||
| 2 | |||
| 3 | const exampleArray = new Arr([ |
||
| 4 | { |
||
| 5 | id: 0, |
||
| 6 | name: 'John', |
||
| 7 | age: 93, |
||
| 8 | city: 'Patmos', |
||
| 9 | }, |
||
| 10 | { |
||
| 11 | id: 1, |
||
| 12 | name: 'Peter', |
||
| 13 | age: 62, |
||
| 14 | city: 'Rome', |
||
| 15 | }, |
||
| 16 | { |
||
| 17 | id: 2, |
||
| 18 | name: 'Luke', |
||
| 19 | age: 84, |
||
| 20 | city: 'Boeotia', |
||
| 21 | }, |
||
| 22 | { |
||
| 23 | id: 2, |
||
| 24 | name: 'Paul', |
||
| 25 | age: 62, |
||
| 26 | city: 'Rome', |
||
| 27 | }, |
||
| 28 | ]); |
||
| 29 | |||
| 30 | const expectedResults = { |
||
| 31 | test1: JSON.stringify(['John', 'Peter', 'Luke', 'Paul']), |
||
| 32 | test2: JSON.stringify([ |
||
| 33 | { |
||
| 34 | name: 'John', |
||
| 35 | age: 93, |
||
| 36 | }, |
||
| 37 | { |
||
| 38 | name: 'Peter', |
||
| 39 | age: 62, |
||
| 40 | }, |
||
| 41 | { |
||
| 42 | name: 'Luke', |
||
| 43 | age: 84, |
||
| 44 | }, |
||
| 45 | { |
||
| 46 | name: 'Paul', |
||
| 47 | age: 62, |
||
| 48 | }, |
||
| 49 | ]), |
||
| 50 | }; |
||
| 51 | |||
| 52 | describe('Multikey', () => { |
||
| 53 | describe('Test 1 (single)', () => { |
||
| 54 | it('Should return the max, in this example should it be 3.', () => { |
||
| 55 | expect(expectedResults.test1).toEqual( |
||
| 56 | JSON.stringify(exampleArray.multikey('name')) |
||
| 57 | ); |
||
| 58 | }); |
||
| 59 | }); |
||
| 60 | |||
| 61 | describe('Test 2 (multiple)', () => { |
||
| 62 | it('Should return the max, in this example should it be 3.', () => { |
||
| 63 | expect(expectedResults.test2).toEqual( |
||
| 64 | JSON.stringify(exampleArray.multikey(['name', 'age'])) |
||
| 65 | ); |
||
| 66 | }); |
||
| 67 | }); |
||
| 68 | }); |
||
| 69 |