-
Notifications
You must be signed in to change notification settings - Fork 629
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
refactor(testing): prepare for noUncheckedIndexedAccess
#4084
refactor(testing): prepare for noUncheckedIndexedAccess
#4084
Conversation
Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
All comments addressed, ready for another review 🙇 |
testing/mock_test.ts
Outdated
assertThrows(() => callback()); | ||
assertEquals(callback("a"), "a"); | ||
assertEquals(callback("b", "c"), "b"); | ||
callback = returnsArg(1); | ||
assertEquals(callback(), undefined); | ||
assertEquals(callback("a"), undefined); | ||
assertThrows(() => callback()); | ||
assertThrows(() => callback("a")); |
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.
Why were these changed?
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.
Following on from this conversation #4084 (comment) the choice was either changing the type or changing the runtime behaviour, you settled on changing the runtime behaviour so the tests needed to change to account for the new behaviour.
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! I see. Hm... Ok. I now better understand how it affected the public API. On second thought, it might be better to add undefined
to the return type instead of error-checking. Sorry, are you able to do that?
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.
No problem, I could have made it more clear. I'll push the change soon.
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.
Thats updated now
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! Thank you for this!
Handling all noUncheckedIndexedAccess issues for the testing module, tracked in #4040