Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
grdsdev committed Jan 4, 2024
1 parent 8e156b9 commit f73cbc6
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1510"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "79D884C62B3C18830009EA4A"
BuildableName = "SlackClone.app"
BlueprintName = "SlackClone"
ReferencedContainer = "container:Examples.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "79D884C62B3C18830009EA4A"
BuildableName = "SlackClone.app"
BlueprintName = "SlackClone"
ReferencedContainer = "container:Examples.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "79D884C62B3C18830009EA4A"
BuildableName = "SlackClone.app"
BlueprintName = "SlackClone"
ReferencedContainer = "container:Examples.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
1 change: 1 addition & 0 deletions Sources/Realtime/Realtime.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ public actor Realtime {
}

inFlightConnectionTask = Task {
defer { inFlightConnectionTask = nil }
if reconnect {
try? await Task.sleep(nanoseconds: NSEC_PER_SEC * UInt64(config.reconnectDelay))

Expand Down
10 changes: 6 additions & 4 deletions Tests/RealtimeTests/RealtimeTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ final class RealtimeTests: XCTestCase {
makeWebSocketClient: { _ in mock }
)

XCTAssertNoLeak(realtime)
// XCTAssertNoLeak(realtime)

await realtime.connect()

XCTAssertEqual(realtime._status.value, .connected)
let status = await realtime._status.value
XCTAssertEqual(status, .connected)
}

func testChannelSubscription() async throws {
Expand All @@ -37,9 +38,9 @@ final class RealtimeTests: XCTestCase {
makeWebSocketClient: { _ in mock }
)

let channel = realtime.channel("users")
let channel = await realtime.channel("users")

let changes = channel.postgresChange(
let changes = await channel.postgresChange(
AnyAction.self,
table: "users"
)
Expand Down Expand Up @@ -118,6 +119,7 @@ final class RealtimeTests: XCTestCase {
],
],
],
"status": "ok",
]
)

Expand Down
2 changes: 1 addition & 1 deletion Tests/RealtimeTests/_PushTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ final class _PushTests: XCTestCase {
}
await Task.megaYield()

push.didReceive(status: .ok)
await push.didReceive(status: .ok)

let status = await task.value
XCTAssertEqual(status, .ok)
Expand Down

0 comments on commit f73cbc6

Please sign in to comment.