Skip to content

Commit

Permalink
fix(datastore): flacky unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
5d committed Aug 27, 2024
1 parent 31d507d commit a6c0a26
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class MutationEventQueryTests: BaseDataStoreTests {
wait(for: [querySuccess], timeout: 1)
}

func testQueryPendingMutationEventsForModelIds() {
func testQueryPendingMutationEventsForModelIds() async {
let mutationEvent1 = generateRandomMutationEvent()
let mutationEvent2 = generateRandomMutationEvent()

Expand All @@ -70,7 +70,7 @@ class MutationEventQueryTests: BaseDataStoreTests {
}
saveMutationEvent1.fulfill()
}
wait(for: [saveMutationEvent1], timeout: 1)
await fulfillment(of: [saveMutationEvent1], timeout: 1)

let saveMutationEvent2 = expectation(description: "save mutationEvent1 success")
storageAdapter.save(mutationEvent2) { result in
Expand All @@ -80,7 +80,7 @@ class MutationEventQueryTests: BaseDataStoreTests {
}
saveMutationEvent2.fulfill()
}
wait(for: [saveMutationEvent2], timeout: 1)
await fulfillment(of: [saveMutationEvent2], timeout: 1)

let querySuccess = expectation(description: "query for metadata success")
var mutationEvents = [mutationEvent1]
Expand All @@ -98,7 +98,7 @@ class MutationEventQueryTests: BaseDataStoreTests {
}
}

wait(for: [querySuccess], timeout: 1)
await fulfillment(of: [querySuccess], timeout: 5)
}

private func generateRandomMutationEvent() -> MutationEvent {
Expand Down

0 comments on commit a6c0a26

Please sign in to comment.