Skip to content

Commit 1bc642c

Browse files
test: Fixes race condition in test
This resolves the race condition caused by the inbox counts and the event delivery. If event delivery happens before the subsequent publish increments the inbox counts, then the counts will be lower than expected. Resolved by just not asking for inbox counts, since they aren't relevant to the test.
1 parent 9b4a6f2 commit 1bc642c

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

Tests/GraphQLTests/SubscriptionTests/SubscriptionTests.swift

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -711,10 +711,6 @@ class SubscriptionTests: XCTestCase {
711711
from
712712
subject
713713
}
714-
inbox {
715-
unread
716-
total
717-
}
718714
}
719715
}
720716
""")
@@ -734,6 +730,8 @@ class SubscriptionTests: XCTestCase {
734730
))
735731

736732
let result1 = try await iterator.next()
733+
let result2 = try await iterator.next()
734+
737735
XCTAssertEqual(
738736
result1,
739737
GraphQLResult(
@@ -742,15 +740,9 @@ class SubscriptionTests: XCTestCase {
742740
"from": "[email protected]",
743741
"subject": "Alright",
744742
],
745-
"inbox": [
746-
"unread": 2,
747-
"total": 3,
748-
],
749743
]]
750744
)
751745
)
752-
753-
let result2 = try await iterator.next()
754746
XCTAssertEqual(
755747
result2,
756748
GraphQLResult(
@@ -759,10 +751,6 @@ class SubscriptionTests: XCTestCase {
759751
"from": "[email protected]",
760752
"subject": "Message 2",
761753
],
762-
"inbox": [
763-
"unread": 2,
764-
"total": 3,
765-
],
766754
]]
767755
)
768756
)

0 commit comments

Comments
 (0)