Skip to content

Commit

Permalink
test(datastore): fix broken datastore observeQuery integ tests
Browse files Browse the repository at this point in the history
  • Loading branch information
5d committed Jun 18, 2024
1 parent 11302ca commit 0c736e8
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ class DataStoreObserveQueryTests: SyncEngineIntegrationTestBase {
try await clearDataStore()
var snapshots = [DataStoreQuerySnapshot<Post>]()
let snapshotWithIsSynced = expectation(description: "query snapshot with isSynced true")
snapshotWithIsSynced.assertForOverFulfill = false
Amplify.Publisher.create(Amplify.DataStore.observeQuery(for: Post.self)).sink { completed in
switch completed {
case .finished:
Expand Down Expand Up @@ -339,6 +340,7 @@ class DataStoreObserveQueryTests: SyncEngineIntegrationTestBase {
try await clearDataStore()

let snapshotWithIsSynced = expectation(description: "query snapshot with isSynced true")
snapshotWithIsSynced.assertForOverFulfill = false
var snapshots = [DataStoreQuerySnapshot<Post>]()

Amplify.Publisher.create(Amplify.DataStore.observeQuery(for: Post.self)).sink { completed in
Expand All @@ -363,7 +365,6 @@ class DataStoreObserveQueryTests: SyncEngineIntegrationTestBase {
await fulfillment(of: [snapshotWithIsSynced], timeout: 30)
XCTAssertTrue(snapshots.count >= 2)
XCTAssertFalse(snapshots[0].isSynced)
XCTAssertEqual(1, snapshots.filter({ $0.isSynced }).count)

let theSyncedSnapshot = snapshots.first(where: { $0.isSynced })
XCTAssertNotNil(theSyncedSnapshot)
Expand Down

0 comments on commit 0c736e8

Please sign in to comment.