|
15 | 15 | */ |
16 | 16 |
|
17 | 17 | import {deepEqual} from 'assert'; |
| 18 | +import { AccountProperties } from '../../../src/model/account/AccountProperties'; |
| 19 | +import { AccountPropertiesInfo } from '../../../src/model/account/AccountPropertiesInfo'; |
| 20 | +import { AccountProperty } from '../../../src/model/account/AccountProperty'; |
18 | 21 | import {Address} from '../../../src/model/account/Address'; |
19 | | -import {AccountPropertiesInfo, PropertyModificationType, PropertyType } from '../../../src/model/model'; |
| 22 | +import { PropertyModificationType } from '../../../src/model/account/PropertyModificationType'; |
| 23 | +import { PropertyType } from '../../../src/model/account/PropertyType'; |
20 | 24 |
|
21 | 25 | describe('AccountPropertiesInfo', () => { |
22 | 26 |
|
23 | 27 | it('should createComplete an AccountPropertiesInfo object', () => { |
24 | 28 |
|
25 | 29 | const accountPropertiesInfoDTO = { |
26 | 30 | meta: {id: '12345'}, |
27 | | - accountProperties: [{ |
28 | | - address: Address.createFromEncoded('9050B9837EFAB4BBE8A4B9BB32D812F9885C00D8FC1650E142'), |
| 31 | + accountProperties: { |
| 32 | + address: '9050B9837EFAB4BBE8A4B9BB32D812F9885C00D8FC1650E142', |
29 | 33 | properties: [{ |
30 | 34 | propertyType: PropertyType.AllowAddress, |
31 | 35 | values: [{modificationType: PropertyModificationType.Add, |
32 | 36 | value: 'SDUP5PLHDXKBX3UU5Q52LAY4WYEKGEWC6IB3VBFM', |
33 | 37 | }], |
34 | 38 | }], |
35 | | - }], |
| 39 | + }, |
36 | 40 | }; |
37 | 41 |
|
38 | 42 | const accountPropertiesInfo = new AccountPropertiesInfo( |
39 | 43 | accountPropertiesInfoDTO.meta, |
40 | | - accountPropertiesInfoDTO.accountProperties, |
| 44 | + new AccountProperties(Address.createFromEncoded(accountPropertiesInfoDTO.accountProperties.address), |
| 45 | + accountPropertiesInfoDTO.accountProperties.properties.map((prop) => |
| 46 | + new AccountProperty(prop.propertyType, prop.values))), |
41 | 47 | ); |
42 | 48 |
|
43 | 49 | deepEqual(accountPropertiesInfo.meta.id, accountPropertiesInfoDTO.meta.id); |
44 | | - deepEqual(accountPropertiesInfo.accountProperties.length, accountPropertiesInfoDTO.accountProperties.length); |
45 | | - deepEqual(accountPropertiesInfo.accountProperties[0].address, accountPropertiesInfoDTO.accountProperties[0].address); |
46 | | - deepEqual(accountPropertiesInfo.accountProperties[0].properties.length, |
47 | | - accountPropertiesInfoDTO.accountProperties[0].properties.length); |
48 | | - deepEqual(accountPropertiesInfo.accountProperties[0].properties[0].values[0], |
49 | | - accountPropertiesInfoDTO.accountProperties[0].properties[0].values[0]); |
| 50 | + deepEqual(accountPropertiesInfo.accountProperties.address, |
| 51 | + Address.createFromEncoded(accountPropertiesInfoDTO.accountProperties.address)); |
| 52 | + deepEqual(accountPropertiesInfo.accountProperties.properties.length, |
| 53 | + accountPropertiesInfoDTO.accountProperties.properties.length); |
| 54 | + deepEqual(accountPropertiesInfo.accountProperties.properties[0].values[0], |
| 55 | + accountPropertiesInfoDTO.accountProperties.properties[0].values[0]); |
50 | 56 | }); |
51 | 57 | }); |
0 commit comments