(value: EntityMetadata)
| 2452 | type UnwrapReference<T extends Reference<any>> = T extends Reference<infer Value> ? Value : T; |
| 2453 | |
| 2454 | function asSnapshot(value: EntityMetadata): EntityMetadata { |
| 2455 | const snap = new EntityMetadata({ ...value }); |
| 2456 | Object.defineProperty(snap, '_id', { writable: false, value: expect.any(Number) }); |
| 2457 | snap.root = expect.any(Object); |
| 2458 | snap.class = expect.any(Function); |
| 2459 | for (const prop of Object.values(snap.properties)) { |
| 2460 | for (const [key, value] of Object.entries(prop)) { |
| 2461 | if (typeof value === 'function') { |
| 2462 | Object.defineProperty(prop, key, { value: expect.any(Function) }); |
| 2463 | } else if (value && typeof value === 'object' && value instanceof Type) { |
| 2464 | Object.defineProperty(prop, key, { value: expect.any(value.constructor) }); |
| 2465 | } |
| 2466 | } |
| 2467 | } |
| 2468 | return snap; |
| 2469 | } |
no test coverage detected