(
userIds: Array<string>,
timeout: number = 10000,
)
| 120 | |
| 121 | // Helper to wait for users to be synced to Electric/TanStack DB |
| 122 | async function waitForUsersSynced( |
| 123 | userIds: Array<string>, |
| 124 | timeout: number = 10000, |
| 125 | ) { |
| 126 | // Use eager collection since it continuously syncs all data |
| 127 | const usersCollection = config.collections.eager.users |
| 128 | await waitFor( |
| 129 | () => { |
| 130 | return userIds.every((userId) => usersCollection.has(userId)) |
| 131 | }, |
| 132 | { |
| 133 | timeout, |
| 134 | message: `Users ${userIds.join(', ')} did not sync to collection`, |
| 135 | }, |
| 136 | ) |
| 137 | } |
| 138 | |
| 139 | // Helper function to run all tests for a given sync mode |
| 140 | function runTestsForSyncMode(syncMode: SyncMode) { |
no test coverage detected