Skip to content

Commit 494e8f4

Browse files
authored
test(auth): add integration test for signOut (#558)
1 parent be154a1 commit 494e8f4

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

Supabase.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 0 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Tests/IntegrationTests/AuthClientIntegrationTests.swift

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,25 @@ final class AuthClientIntegrationTests: XCTestCase {
259259
XCTAssertEqual(pagination.nextPage, 2)
260260
}
261261

262+
func testSignOut() async throws {
263+
try await XCTAssertAuthChangeEvents([.initialSession, .signedIn, .signedOut]) {
264+
try await signUpIfNeededOrSignIn(email: mockEmail(), password: mockPassword())
265+
266+
_ = try await authClient.session
267+
XCTAssertNotNil(authClient.currentSession)
268+
269+
try await authClient.signOut()
270+
271+
do {
272+
_ = try await authClient.session
273+
XCTFail("Expected to throw AuthError.sessionMissing")
274+
} catch let error as AuthError {
275+
XCTAssertEqual(error, .sessionMissing)
276+
}
277+
XCTAssertNil(authClient.currentSession)
278+
}
279+
}
280+
262281
@discardableResult
263282
private func signUpIfNeededOrSignIn(
264283
email: String,

0 commit comments

Comments
 (0)