Skip to content

Commit

Permalink
test(auth): add integration test for signOut (#558)
Browse files Browse the repository at this point in the history
  • Loading branch information
grdsdev authored Oct 9, 2024
1 parent be154a1 commit 494e8f4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
9 changes: 0 additions & 9 deletions Supabase.xcworkspace/xcshareddata/swiftpm/Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,6 @@
"version" : "4.1.1"
}
},
{
"identity" : "multipartformdata",
"kind" : "remoteSourceControl",
"location" : "https://github.com/grdsdev/MultipartFormData",
"state" : {
"revision" : "ed7abea9cfc6c3b5e77a73fe6842c57a372d2017",
"version" : "0.1.0"
}
},
{
"identity" : "svgview",
"kind" : "remoteSourceControl",
Expand Down
19 changes: 19 additions & 0 deletions Tests/IntegrationTests/AuthClientIntegrationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,25 @@ final class AuthClientIntegrationTests: XCTestCase {
XCTAssertEqual(pagination.nextPage, 2)
}

func testSignOut() async throws {
try await XCTAssertAuthChangeEvents([.initialSession, .signedIn, .signedOut]) {
try await signUpIfNeededOrSignIn(email: mockEmail(), password: mockPassword())

_ = try await authClient.session
XCTAssertNotNil(authClient.currentSession)

try await authClient.signOut()

do {
_ = try await authClient.session
XCTFail("Expected to throw AuthError.sessionMissing")
} catch let error as AuthError {
XCTAssertEqual(error, .sessionMissing)
}
XCTAssertNil(authClient.currentSession)
}
}

@discardableResult
private func signUpIfNeededOrSignIn(
email: String,
Expand Down

0 comments on commit 494e8f4

Please sign in to comment.