Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some test failures that result from Realtime error changes #2006

Merged
merged 3 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Test/Tests/AuthTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ class AuthTests: XCTestCase {
guard let errorInfo = stateChange.reason else {
fail("ErrorInfo is nil"); done(); return
}
expect(errorInfo.message).to(contain("No application found with id"))
expect(errorInfo.code).to(equal(ARTErrorCode.invalidCredentials.intValue))
done()
}
realtime.connection.once(.disconnected) { _ in
Expand Down
3 changes: 2 additions & 1 deletion Test/Tests/RealtimeClientConnectionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4132,7 +4132,8 @@ class RealtimeClientConnectionTests: XCTestCase {
guard let error = stateChange.reason else {
fail("Error is nil"); done(); return
}
XCTAssertTrue(error.code == ARTErrorCode.invalidCredential.rawValue)
// This is because, at time of writing, the production environment is handling connections using both frontend (which returns invalidCredential) and frontdoor (which returns invalidCredentials). So we need to handle both cases at least for now (unlike other tests, which use sandbox which is 100% using frontdoor).
XCTAssertTrue(error.code == ARTErrorCode.invalidCredential.rawValue || error.code == ARTErrorCode.invalidCredentials.rawValue)
done()
}
}
Expand Down
4 changes: 2 additions & 2 deletions Test/Tests/RestClientTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ class RestClientTests: XCTestCase {

let publishTask = publishTestMessage(client, channelName: test.uniqueChannelName(), failOnError: false)

expect(publishTask.error?.code).toEventually(equal(ARTErrorCode.invalidCredential.intValue), timeout: testTimeout)
expect(publishTask.error?.code).toEventually(equal(ARTErrorCode.invalidCredentials.intValue), timeout: testTimeout)
}

func test__018__RestClient__initializer__should_accept_a_token() throws {
Expand Down Expand Up @@ -234,7 +234,7 @@ class RestClientTests: XCTestCase {

let publishTask = publishTestMessage(client, channelName: test.uniqueChannelName(), failOnError: false)

expect(publishTask.error?.code).toEventually(equal(ARTErrorCode.invalidCredential.intValue), timeout: testTimeout)
expect(publishTask.error?.code).toEventually(equal(ARTErrorCode.invalidCredentials.intValue), timeout: testTimeout)
}

// RSC2
Expand Down
Loading