Skip to content

Commit

Permalink
used proper waitFor syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
icehaunter committed Dec 10, 2024
1 parent 288fe0c commit 101a968
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
4 changes: 1 addition & 3 deletions packages/react-hooks/test/react-hooks.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -363,9 +363,7 @@ describe(`useShape`, () => {
})

// And wait until it's definitely seen
await waitFor(async () => {
return parallelWaiterStream.isUpToDate || (await sleep(50))
})
await waitFor(() => parallelWaiterStream.isUpToDate)

await sleep(50)

Expand Down
16 changes: 4 additions & 12 deletions packages/typescript-client/test/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,10 +307,7 @@ describe(`HTTP Sync`, () => {
]
)

await vi.waitFor(async () => {
await sleep(100)
return client.isUpToDate
})
await vi.waitFor(() => client.isUpToDate)
const updatedData = await client.rows

expect(updatedData).toMatchObject([

Check failure on line 313 in packages/typescript-client/test/integration.test.ts

View workflow job for this annotation

GitHub Actions / Build and test (packages/typescript-client)

test/integration.test.ts > HTTP Sync > should parse incoming data

AssertionError: expected [ { txt: 'test', i2: 1, …(18) } ] to match object [ { txt: 'changed', i2: 1, …(18) } ] (3 matching properties omitted from actual) - Expected + Received Array [ Object { - "b": false, + "b": true, "bools": Array [ - false, true, false, + true, ], "complexes": Array [ - "(2.2,3.3)", - "(4.4,5.5)", + "(1.1,2.2)", + "(3.3,4.4)", ], "doubles": Array [ Infinity, - NaN, -Infinity, + NaN, ], - "f8": 40.5, + "f8": 4.5, "i2": 1, - "i4": 20, - "i8": 30n, + "i4": 2147483647, + "i8": 9223372036854775807n, "int4s": Array [ - 4, - 5, - 6, + 1, + 2, + 3, ], "ints": Array [ - 4n, - 5n, - 6n, + 1n, + 2n, + 3n, ], "ints2": Array [ Array [ + 1n, + 2n, + 3n, + ], + Array [ 4n, 5n, 6n, ], - Array [ - 7n, - 8n, - 9n, - ], ], "json": Object { - "bar": "foo", + "foo": "bar", }, "jsonb": Object { - "bar": "foo", + "foo": "bar", }, "jsons": Array [ - Object {}, + Object { + "foo": "bar", + }, + Object { + "bar": "baz", + }, ], "moods": Array [ "sad", + "ok", "happy", ], "moods2": Array [ Array [ "sad", - "happy", + "ok", ], Array [ + "ok", "happy", - "ok", ], ], "posints": Array [ - "6", - "10", - "3", + "5", + "9", + "2", ], - "txt": "changed", + "txt": "test", "txts": Array [ - "new", - "values", + "foo", + "bar", + "baz", ], "value": Object { - "a": 6, + "a": 5, }, }, ] ❯ test/integration.test.ts:313:27
Expand Down Expand Up @@ -528,10 +525,7 @@ describe(`HTTP Sync`, () => {
)

// And wait until it's definitely seen
await vi.waitFor(async () => {
await sleep(50)
return issueStream.isUpToDate
})
await vi.waitFor(() => issueStream.isUpToDate)

let catchupOpsCount = 0
const newAborter = new AbortController()
Expand Down Expand Up @@ -589,6 +583,7 @@ describe(`HTTP Sync`, () => {
// Wait for server to get all the messages.
await sleep(40)

// Request to the beginning of the stream should return an unchanged e-tag for the first chunk
const res2 = await fetch(
`${BASE_URL}/v1/shape?table=${issuesTableUrl}&offset=-1`
)
Expand Down Expand Up @@ -799,10 +794,7 @@ describe(`HTTP Sync`, () => {
)

// And wait until it's definitely seen
await vi.waitFor(async () => {
await sleep(50)
return issueStream.isUpToDate
})
await vi.waitFor(() => issueStream.isUpToDate)

const responseSizes: number[] = []

Expand Down

0 comments on commit 101a968

Please sign in to comment.