-
Notifications
You must be signed in to change notification settings - Fork 4
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
Add appointment to Claim Status summary #345
Conversation
timeSlot: { | ||
table: { | ||
disable: true, | ||
}, | ||
}, | ||
}, |
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.
Note: This hides the timeSlot
argument from the Storybook Controls. Let me know if you disagree with this approach.
import enUS from 'date-fns/locale/en-US' | ||
import es from 'date-fns/locale/es' |
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.
Note: Locales are imported from https://github.com/date-fns/date-fns/tree/master/src/locale
*/ | ||
export function getDateWithOffset(daysOffset = 1): Date { | ||
export function formatFromApiGateway(daysOffset = 1): string { |
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.
Note: I eliminated getDateWithOffset()
as a standalone function because it tempted me into falling into the trap where running tests on different machines (with different server timezones) caused tests to fail. We should always be testing using the timezone-free datetime strings that the API gateway will give us.
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.
Couple small questions!
@@ -0,0 +1,49 @@ | |||
import { useTranslation } from 'next-i18next' |
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.
:chef-kiss: component!
const testCases = [ | ||
['with no time slot, then match the snapshot', null, null], | ||
['with a morning time slot, then match the snapshot', 8, 10], | ||
['with an afternoon time slot, then match the snapshot', 1, 3], | ||
['with a time slot that starts in the morning and ends in the afternoon, then match the snapshot', 8, 3], | ||
['with a time slot that has a nonsense time range, then match the snapshot', 3, 9], | ||
] |
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 love this setup!
['with a morning time slot, then match the snapshot', 8, 10], | ||
['with an afternoon time slot, then match the snapshot', 1, 3], | ||
['with a time slot that starts in the morning and ends in the afternoon, then match the snapshot', 8, 3], | ||
['with a time slot that has a nonsense time range, then match the snapshot', 3, 9], |
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.
we just wanna allow this? 👀
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 this is a good question. I'm not positive? I'll open a new ticket for this.
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.
Ticket is #351
/** | ||
* Common test helpers to create shared mock data. | ||
*/ |
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.
🎉
// Test buildAppointment() | ||
describe('An appointment is', () => { |
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.
really appreciate the nice layering of these tests to scope to each level's concerns
min: 1, | ||
max: 12, | ||
}, | ||
}, | ||
end: { | ||
name: 'end time', | ||
table: { | ||
type: { | ||
summary: 'number', | ||
}, | ||
}, | ||
control: { | ||
type: 'number', | ||
min: 1, | ||
max: 12, |
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.
these don't seem to stop me:
Friday, July 30, 2021, between 12–15 p.m. Pacific time
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.
Hmmmm. I'm going to go ahead and merge this without resolving it. I'll open a follow up (low priority) ticket.
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.
Ticket is #350
Ticket
Resolves #341
Changes
<Appointment>
component (with story and tests)<ClaimSummary>
component (with story and tests)<ClaimStatus>
componentgetScenarioContent.test.tsx
)Context
This PR is big, but it is only actually handling one very narrow case: when to display the appointment date (
pendingDetermination.scheduleDate
) and time (pendingDetermination.timeSlotDesc
) and how to format it.Testing
yarn test
ALSO
ui-claim-tracker/pages/index.tsx
Lines 95 to 98 in 32990f8
yarn storybook
Note: that some Spanish translation strings are still missing from
main
at the moment, but will be added with #329.