-
Notifications
You must be signed in to change notification settings - Fork 179
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
feat(protocol-designer): add modal to pause after set temp #5182
Conversation
Codecov Report
@@ Coverage Diff @@
## edge #5182 +/- ##
==========================================
+ Coverage 60.29% 60.31% +0.02%
==========================================
Files 1025 1027 +2
Lines 29062 29452 +390
==========================================
+ Hits 17522 17765 +243
- Misses 11540 11687 +147
Continue to review full report at Codecov.
|
import type { StepType, StepIdType, FormData } from '../../../../form-types' | ||
import type { GetState, ThunkDispatch } from '../../../../types' | ||
|
||
export const addAndSelectStepWithHints = (payload: { stepType: StepType }) => ( |
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 refactored this to be distinct from the more generic addStep
b/c I figured we don't want generally want hints showing up to steps that are programatically added (eg this new automatically-added "pause until temp")
@@ -0,0 +1,195 @@ | |||
// @flow |
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.
this file used to be thunks.js
const payload = { stepType } | ||
addAndSelectStepWithHints(payload)(dispatch, getState) | ||
|
||
expect(addStepMock.mock.calls).toEqual([[payload]]) |
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 feel it's more ergonomic to use someMock.mock.calls
and toEqual
instead of doing expect(someMock).toHaveBeenCalledTimes(2); expect(someMock).toHaveBeenNthCalledWith(1, 'stuff'); expect(someMock).toHaveBeenNthCalledWith(2, 'otherStuff')
-- any objections for this matcher in cases like these? It gives you a clear diff; the main con is that you have to remember the outer []
representing the array of calls
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.
For the action creator tests using redux-thunk, you could use the mock store so you don't have to mock out the thunks. There is an example in the [https://redux.js.org/recipes/writing-tests/#async-action-creators](redux docs).
]) | ||
}) | ||
|
||
describe('should dispatch ADD_STEP, and also ADD_HINT "module_without_labware" for module steps if module lacks labware', () => { |
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 think the describe block text sounds like it should be reversed with the testName text. It will read better and follow conventions.
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.
🌡 ⏯
- Saving a Temperature step with "set temp" should trigger the modal. Modal should match design in PD: Add prompt modal after saving Temperature step #5117. Temperature number should be correct in the modal.
- Clicking "I will build a pause later" should save the current form and do nothing else. The Temperature step should still be selected
- Clicking "Pause protocol now" should create a new Pause step which will be selected in the sidebar but the form should be closed (as if you just clicked "save" on that form). The Pause step should "pause until temperature reached" with the same temperature
- Making a Temperature step with "deactivate" should not trigger the new modal
- Really tried to break it. No white screens and accurate error messages when reordering or deleting steps/modules!
This could be a good approach. I tried it out just now with the I'm now going to try using the mock store like in the example to add tests for
|
overview
Closes #5117
changelog
review requests
Code
Behavior