-
Notifications
You must be signed in to change notification settings - Fork 43
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
clean up majority of frontend test warnings. #1078
Conversation
@@ -66,7 +66,7 @@ | |||
"devDependencies": { | |||
"@babel/preset-typescript": "7.8.3", | |||
"@react-leaflet/core": "1.0.2", | |||
"@testing-library/dom": "7.2.2", | |||
"@testing-library/dom": "7.22.1", |
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 cleans up a warning within the tests.
const touch = getIn(touched, field); | ||
const checked = getIn(values, field); | ||
const error = getIn(errors, field); | ||
const asElement: any = is || 'input'; | ||
useEffect(() => { | ||
if (checked === true || checked === false) { | ||
if ((checked === true || checked === false) && initialChecked !== checked) { |
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 useeffect shouldn't be triggered on page load just because the initialvalue (and therefore the value) is not undefined.
it('renders RequestAccessPage correctly', () => { | ||
const tree = renderer |
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.
renderer.create has a separate setup/teardown/act pattern that we aren't using, rather then implement that pattern and the pattern used by react-testing-library, just switch to using react-testing-library for snapshots consistently across the application to avoid act warnings.
<ManageAccessRequests /> | ||
</Provider> | ||
</Router>, | ||
<Formik initialValues={{}} onSubmit={noop}> |
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.
due to some changes in the table, any test component wrapping the table needs to include a Formik provider to avoid warnings.
@@ -66,30 +67,28 @@ const getStore = () => | |||
}); | |||
|
|||
describe('Manage Agencies Component', () => { | |||
beforeAll(() => { | |||
const { getComputedStyle } = window; |
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 just fixes test warnings, no functional changes. see NickColley/jest-axe#147
Codecov Report
@@ Coverage Diff @@
## dev #1078 +/- ##
=======================================
Coverage 65.31% 65.32%
=======================================
Files 787 787
Lines 22211 22222 +11
Branches 3765 3769 +4
=======================================
+ Hits 14507 14516 +9
- Misses 7329 7331 +2
Partials 375 375
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@@ -89,6 +88,35 @@ const getMockProject = (statusCode?: string): IProject => ({ | |||
isActive: false, | |||
workflowCode: '', | |||
}, | |||
marketedOn: '2020-01-01', |
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 financials ensure that the calculated gainBeforeSpl and netProceeds will not change when the form loads from calculations. This allows the test to proceed without having to specifically wait for those calculations to update the dom.
); | ||
}, [market, interestComponent, salesCost, netBook, setFieldValue]); | ||
if (gainBeforeSpl !== calculatedValue) { |
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.
one of the few code changes in this PR, don't trigger a state update unless the value has actually changed.
getNumber(salesCost), | ||
getNumber(netBook), | ||
), | ||
const calculatedValue = calcGainBeforeSpl( |
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.
due to duplicated code I had to make the same code change as the projectfinancialsTable here as well.
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.
Nice work
No description provided.