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
Port Functions integration tests to Swift #8957
Conversation
Generated by 🚫 Danger |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 LGTM, a couple non-blocking nits.
FirebaseFunctions/Tests/SwiftIntegration/IntegrationTests.swift
Outdated
Show resolved
Hide resolved
FirebaseFunctions/Tests/SwiftIntegration/IntegrationTests.swift
Outdated
Show resolved
Hide resolved
FirebaseFunctions/Tests/SwiftIntegration/IntegrationTests.swift
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the thorough review and good suggestions!
FirebaseFunctions/Tests/SwiftIntegration/IntegrationTests.swift
Outdated
Show resolved
Hide resolved
FirebaseFunctions/Tests/SwiftIntegration/IntegrationTests.swift
Outdated
Show resolved
Hide resolved
do { | ||
XCTAssertNotNil(error) | ||
let error = try XCTUnwrap(error) as NSError | ||
XCTAssertEqual(FunctionsErrorCode.internal.rawValue, error.code) | ||
XCTAssertEqual("Response is missing data field.", error.localizedDescription) | ||
expectation.fulfill() | ||
} catch { | ||
XCTAssert(false, "Failed to unwrap the function result: \(error)") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. You can avoid the do {} catch {}
blocks by adding throws
to the test method signature. If the XCTUnwrap
fails, it'll highlight the line with the failing unwrap.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it will work if XCTUnwrap
is used inside of the closure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right @maksymmalyhin That's what I found:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, never thought about that. Makes sense, thanks for pointing that out y'all!
init
function not bridging to Swift because of its parameters using forward declarations and to use the existing Objective C fake implementationsFuture PRs will: