-
Notifications
You must be signed in to change notification settings - Fork 735
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
test: move the confirm mock code to its own file #148
test: move the confirm mock code to its own file #148
Conversation
|
d101fe7
to
b4652f8
Compare
This can probably be confusing in the future. Suggestion - create a |
Ooh! TIL... |
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.
tentatively approving, with a couple of suggestions.
/** | ||
* The expected values for a confirmation request. | ||
*/ | ||
export interface ConfirmExpectation { |
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.
does this need to be exported?
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 am not sure if it "has" to be exported. But since it is used as the type of a parameter of an exported function it seems the right thing to do...
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, is this because if someone wants to construct the arguments separately before passing it to mockConfirm/mockPrompt, they'll have the type to use? Ok, I can buy that.
This commit moves the mocking code for the `confirm()` helper out of the main test file and into a helper file. It also adds an equivalent helper for `prompt()`. Apart from keeping the main test file simpler, it also will allow reuse in other test files in the future.
003c5f9
to
fdc7fdf
Compare
This commit moves the mocking code for the
confirm()
helper out of the main test file and into a helper file.Apart from keeping the main test file simpler, it also will allow reuse in other test files in the future.
NOTE that the following line must still appear in the test file to ensure the module gets mocked before it is first used.