()
| 26 | } |
| 27 | |
| 28 | function createSimpleMetadata(): MetadataStorage { |
| 29 | const storage = new MetadataStorage(); |
| 30 | const meta = new EntityMetadata({ |
| 31 | class: User as any, |
| 32 | className: 'User', |
| 33 | name: 'User', |
| 34 | tableName: 'user', |
| 35 | primaryKeys: ['id'], |
| 36 | comparableProps: [], |
| 37 | hydrateProps: [], |
| 38 | bidirectionalRelations: [], |
| 39 | }); |
| 40 | meta.properties = { |
| 41 | id: { |
| 42 | name: 'id', |
| 43 | fieldNames: ['id'], |
| 44 | columnTypes: ['integer'], |
| 45 | kind: ReferenceKind.SCALAR, |
| 46 | primary: true, |
| 47 | type: 'number', |
| 48 | }, |
| 49 | name: { |
| 50 | name: 'name', |
| 51 | fieldNames: ['name'], |
| 52 | columnTypes: ['varchar(255)'], |
| 53 | kind: ReferenceKind.SCALAR, |
| 54 | type: 'string', |
| 55 | }, |
| 56 | } as any; |
| 57 | meta.root = meta; |
| 58 | meta.props = Object.values(meta.properties); |
| 59 | meta.comparableProps = [meta.properties.id as any, meta.properties.name as any]; |
| 60 | meta.hydrateProps = meta.props; |
| 61 | storage.set(User as any, meta); |
| 62 | |
| 63 | const embeddableMeta = new EntityMetadata({ |
| 64 | class: Address as any, |
| 65 | className: 'Address', |
| 66 | name: 'Address', |
| 67 | embeddable: true, |
| 68 | primaryKeys: [], |
| 69 | comparableProps: [], |
| 70 | hydrateProps: [], |
| 71 | bidirectionalRelations: [], |
| 72 | }); |
| 73 | embeddableMeta.properties = { |
| 74 | street: { |
| 75 | name: 'street', |
| 76 | fieldNames: ['street'], |
| 77 | columnTypes: ['varchar(255)'], |
| 78 | kind: ReferenceKind.SCALAR, |
| 79 | type: 'string', |
| 80 | }, |
| 81 | } as any; |
| 82 | embeddableMeta.root = embeddableMeta; |
| 83 | embeddableMeta.props = Object.values(embeddableMeta.properties); |
| 84 | embeddableMeta.comparableProps = [embeddableMeta.properties.street as any]; |
| 85 | embeddableMeta.hydrateProps = embeddableMeta.props; |
no test coverage detected