MCPcopy Create free account
hub / github.com/TanStack/db / waitForUsersSynced

Function waitForUsersSynced

packages/db-collection-e2e/src/suites/moves.suite.ts:122–137  ·  view source on GitHub ↗
(
      userIds: Array<string>,
      timeout: number = 10000,
    )

Source from the content-addressed store, hash-verified

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) {

Callers 1

runTestsForSyncModeFunction · 0.85

Calls 3

waitForFunction · 0.90
hasMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected