Skip to content

Commit 9ed6c1c

Browse files
authored
test(datastore): fix broken datastore observeQuery integ tests (#3752)
1 parent 11302ca commit 9ed6c1c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

AmplifyPlugins/DataStore/Tests/DataStoreHostApp/AWSDataStorePluginIntegrationTests/DataStoreObserveQueryTests.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ class DataStoreObserveQueryTests: SyncEngineIntegrationTestBase {
8383
try await clearDataStore()
8484
var snapshots = [DataStoreQuerySnapshot<Post>]()
8585
let snapshotWithIsSynced = expectation(description: "query snapshot with isSynced true")
86+
snapshotWithIsSynced.assertForOverFulfill = false
8687
Amplify.Publisher.create(Amplify.DataStore.observeQuery(for: Post.self)).sink { completed in
8788
switch completed {
8889
case .finished:
@@ -130,6 +131,7 @@ class DataStoreObserveQueryTests: SyncEngineIntegrationTestBase {
130131
var isObserveQueryReadyForTest = false
131132
let observeQueryReadyForTest = expectation(description: "received query snapshot with .isSynced true")
132133
let snapshotWithPost = expectation(description: "received first snapshot")
134+
snapshotWithPost.assertForOverFulfill = false
133135
let post = Post(title: "title", content: "content", createdAt: .now())
134136
Amplify.Publisher.create(Amplify.DataStore.observeQuery(for: Post.self)).sink { completed in
135137
switch completed {
@@ -339,6 +341,7 @@ class DataStoreObserveQueryTests: SyncEngineIntegrationTestBase {
339341
try await clearDataStore()
340342

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

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

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

0 commit comments

Comments
 (0)