Commits
Mathias Wulff Tejlgaard authored 8edccc335db
1 1 | import {DataCardWrapper} from './dataCard.wrapper'; |
2 2 | import {DataCard} from 'facade-api'; |
3 3 | |
4 4 | describe('DataCardWrapper', () => { |
5 5 | it('reads and writes values for all properties', () => { |
6 6 | const dataCard = {} as unknown as DataCard; |
7 7 | const subject = new DataCardWrapper(dataCard); |
8 8 | let length = 2; |
9 - | Object.getOwnPropertyNames((subject as any).__proto__).forEach((property, index) => { |
9 + | Object.getOwnPropertyNames(DataCardWrapper.prototype).forEach((property, index) => { |
10 10 | if (typeof (subject as any)[property] === 'undefined') { |
11 11 | (subject as any)[property] = `${index} value`; |
12 12 | expect((subject as any)[property]).toBe(`${index} value`, `failed to read back the value set in '${property}'`); |
13 13 | const stringified = JSON.stringify(dataCard); |
14 14 | expect(stringified.length > length) |
15 15 | .toBeTruthy(`Expected length of dataCard as json to be greater than ${length} after setting ${property} but it was ${stringified.length}`); |
16 16 | length = stringified.length; |
17 17 | } |
18 18 | }); |
19 19 | // Randomly selected tests |