Closed amnonbc closed 2 months ago
The pull request introduces modifications to the assertions in the AuthTests
class. The original assertion that verified the presence of a specific string in the stateChange.reason?.description
has been replaced with two distinct assertions. These new assertions check for the presence of the substrings "token" and "expire" separately, enhancing the specificity of the test without altering any exported or public entity declarations.
File | Change Summary |
---|---|
Test/Tests/AuthTests.swift | Modified assertions in AuthTests to check for "token" and "expire" separately in stateChange.reason?.description . |
In the realm of tests so bright,
A rabbit hops with pure delight.
"Token" and "expire" now stand tall,
In assertions, they won't fall.
With clarity in each little check,
Our tests are strong, what the heck! 🐇✨
Test/Tests/AuthTests.swift (1)
`4162-4163`: **Good improvement on error description assertions** The updated assertions enhance the test's resilience by checking for key substrings "token" and "expire", reducing dependence on the exact error message.
@amnonbc I thought I dealt with these types of tests in this SDK but perhaps not, none of them should assert on the error message, only the error code.
I made similar changes in other SDKs, e.g.:
https://github.com/ably/ably-java/pull/1023 https://github.com/ably/ably-ruby/pull/432
If you look at this diff, I removed some error message checks on my branch, but I forgot to PR:
If you look at this diff, I removed some error message checks on my branch, but I forgot to PR:
It looks like these got fixed in https://github.com/ably/ably-cocoa/commit/b98ce6ebd0cb8a0e1eb1a6ed47e18b5c8778e605
@amnonbc is this intended for review or should it be a draft?
@amnonbc is this intended for review or should it be a draft?
It is intended for review. Basically it is wrong for tests to rely on the exact wording of an error message, as we do not guarantee that these message will not change over time. When we reword an error message returned by Realtime to improve readability of the error message, this should not create failures in SDKs.
I’m assuming that some of the other test failures here also are from the time when sandbox WebSocket handling was through frontdoor (i.e. this Slack message)? I’ll re-run the tests to check they go away, and if so will merge.
The current test is over-specified - searching for exact error text. Updated so test asserts that error text contains the words token and expire
Fixes https://ably.atlassian.net/jira/software/projects/RAR/boards/159?selectedIssue=RAR-692
::error file=/Users/runner/work/ably-cocoa/ably-cocoa/Test/Tests/AuthTests.swift,line=4162:: test__144__JWT_and_realtime__when_using_authUrl__when_token_expires__receives_a_40142_error_from_the_server, expected to contain <Key/token status changed (expire)>, got <Error 40142 - Key/token status changed (token expired).
Summary by CodeRabbit