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

refactor(testing): prepare for noUncheckedIndexedAccess #4084

Merged
merged 11 commits into from
Jan 4, 2024

Conversation

syhol
Copy link
Contributor

@syhol syhol commented Jan 4, 2024

Handling all noUncheckedIndexedAccess issues for the testing module, tracked in #4040

@syhol syhol requested a review from kt3k as a code owner January 4, 2024 01:33
testing/mock.ts Show resolved Hide resolved
testing/bdd_test.ts Outdated Show resolved Hide resolved
testing/mock.ts Show resolved Hide resolved
testing/mock.ts Outdated Show resolved Hide resolved
testing/bdd_test.ts Outdated Show resolved Hide resolved
@syhol
Copy link
Contributor Author

syhol commented Jan 4, 2024

All comments addressed, ready for another review 🙇

Comment on lines 1785 to 1790
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"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why were these changed?

Copy link
Contributor Author

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.

Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats updated now

Copy link
Contributor

@iuioiua iuioiua left a 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!

@iuioiua iuioiua merged commit 0858ff8 into denoland:main Jan 4, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants