-
Notifications
You must be signed in to change notification settings - Fork 166
Use testing-library ESLint plugin #9870
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,9 +44,11 @@ const DEFAULT_PROPS = { | |
| describe('InPersonLocationFullAddressEntryPostOfficeSearchStep', () => { | ||
| const usStatesTerritories: [string, string][] = [['Delware', 'DE']]; | ||
| const locationsURL = 'https://localhost:3000/locations/endpoint'; | ||
| const inPersonURL = '#in_person'; | ||
| const wrapper: ComponentType = ({ children }) => ( | ||
| <InPersonContext.Provider | ||
| value={{ | ||
| inPersonURL, | ||
| locationsURL, | ||
| addressSearchURL: 'https://localhost:3000', | ||
| inPersonOutageMessageEnabled: false, | ||
|
|
@@ -74,7 +76,10 @@ describe('InPersonLocationFullAddressEntryPostOfficeSearchStep', () => { | |
| beforeEach(() => { | ||
| server.resetHandlers(); | ||
| // todo: should we return USPS_RESPONSE here? | ||
| server.use(rest.post(locationsURL, (_req, res, ctx) => res(ctx.json([{ name: 'Baltimore' }])))); | ||
| server.use( | ||
| rest.post(locationsURL, (_req, res, ctx) => res(ctx.json([{ name: 'Baltimore' }]))), | ||
| rest.put(locationsURL, (_req, res, ctx) => res(ctx.json({ success: true }))), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. was this like a missing stub?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes, with the previous code, we weren't awaiting |
||
| ); | ||
| }); | ||
|
|
||
| it('renders the step', () => { | ||
|
|
@@ -326,8 +331,11 @@ describe('InPersonLocationFullAddressEntryPostOfficeSearchStep', () => { | |
| await findByLabelText('in_person_proofing.body.location.po_search.zipcode_label'), | ||
| ); | ||
|
|
||
| await userEvent.click(findAllByText('in_person_proofing.body.location.location_button')[0]); | ||
| await userEvent.click( | ||
| (await findAllByText('in_person_proofing.body.location.location_button'))[0], | ||
| ); | ||
|
|
||
| expect(await queryByText('simple_form.required.text')).to.be.null(); | ||
| expect(queryByText('simple_form.required.text')).to.be.null(); | ||
| expect(window.location.hash).to.equal(inPersonURL); | ||
| }); | ||
| }); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -137,9 +137,10 @@ describe('document-capture/components/document-capture', () => { | |
| submitButton = getByText('forms.buttons.submit.default'); | ||
| expect(isFormValid(submitButton.closest('form'))).to.be.true(); | ||
|
|
||
| // eslint-disable-next-line require-await | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change is somewhat strange and unexpected. Without it, it identifies the My guess is that some transitive dependency of what's changed in |
||
| await new Promise((resolve) => { | ||
| onSubmit.callsFake(resolve); | ||
| // eslint-disable-next-line no-restricted-syntax | ||
| // eslint-disable-next-line testing-library/await-async-events | ||
| userEvent.click(submitButton); | ||
| }); | ||
|
|
||
|
|
||
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.
what's gonna lint this file to detect trailing spaces? 😛