( collection: Collection<T>, expectedMaxIds: Array<string>, message?: string, )
| 138 | * This checks that the collection didn't load more data than necessary |
| 139 | */ |
| 140 | export function assertNoPushdownViolation<T extends { id: string }>( |
| 141 | collection: Collection<T>, |
| 142 | expectedMaxIds: Array<string>, |
| 143 | message?: string, |
| 144 | ) { |
| 145 | const loadedIds = getLoadedIds(collection) |
| 146 | const expectedSet = new Set(expectedMaxIds) |
| 147 | |
| 148 | // Check if any loaded IDs are not in expected set |
| 149 | const extraIds = loadedIds.filter((id) => !expectedSet.has(id)) |
| 150 | |
| 151 | if (extraIds.length > 0) { |
| 152 | throw new Error( |
| 153 | message ?? |
| 154 | `Predicate pushdown violation: Collection loaded ${extraIds.length} extra item(s) that don't match the predicate`, |
| 155 | ) |
| 156 | } |
| 157 | } |
| 158 | |
| 159 | /** |
| 160 | * Assert that deduplication occurred |
nothing calls this directly
no test coverage detected
searching dependent graphs…