( collection: Collection<T>, forbiddenIds: Array<string>, message?: string, )
| 57 | * Assert that a collection has NOT loaded any of the specified items |
| 58 | */ |
| 59 | export function assertNotLoaded<T extends { id: string }>( |
| 60 | collection: Collection<T>, |
| 61 | forbiddenIds: Array<string>, |
| 62 | message?: string, |
| 63 | ) { |
| 64 | const loadedIds = getLoadedIds(collection) |
| 65 | const loadedSet = new Set(loadedIds) |
| 66 | |
| 67 | const foundIds = forbiddenIds.filter((id) => loadedSet.has(id)) |
| 68 | if (foundIds.length > 0) { |
| 69 | throw new Error( |
| 70 | message ?? `Collection should not have loaded: ${foundIds.join(`, `)}`, |
| 71 | ) |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | /** |
| 76 | * Assert that a collection's size matches expected |
nothing calls this directly
no test coverage detected
searching dependent graphs…