-
Notifications
You must be signed in to change notification settings - Fork 364
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: [M3-7863] - Use happy-dom
instead of jsdom
in unit tests
#11085
Changes from 7 commits
f20da70
451a3e4
c172999
f34aae6
2ff4197
f2d53ad
d17fd00
0123759
10213d2
a9a5fb3
3335ff7
2cc590e
9a20202
dad3c4f
85e5e56
94630bb
d618969
666cac2
6433f3d
26e45e4
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 |
---|---|---|
|
@@ -33,7 +33,7 @@ describe('Disks', () => { | |
const { getByTestId } = render(wrapWithTheme(<Disks {...props} />)); | ||
disks.forEach((eachDisk) => { | ||
const checkbox = getByTestId(`checkbox-${eachDisk.id}`).parentNode; | ||
fireEvent.click(checkbox as any); | ||
fireEvent.click(checkbox!); | ||
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. Should we also rewrite this as a 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. Ideally yes, but I want to keep this PR's scope as narrow as possible so it is representative of what was absolutely necessary to change to get There are so many places where |
||
expect(mockHandleSelect).toHaveBeenCalledWith(eachDisk.id); | ||
}); | ||
}); | ||
|
@@ -47,10 +47,10 @@ describe('Disks', () => { | |
}); | ||
|
||
it('checks the disk if the associated config is selected', () => { | ||
const { getByTestId } = render( | ||
const { getByRole } = render( | ||
wrapWithTheme(<Disks {...props} selectedConfigIds={[9859511]} />) | ||
); | ||
const checkbox: any = getByTestId('checkbox-19040624').firstElementChild; | ||
expect(checkbox).toHaveAttribute('checked'); | ||
const checkbox = getByRole('checkbox', { name: '512 MB Swap Image' }); | ||
expect(checkbox).toBeChecked(); | ||
}); | ||
}); |
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.
The is the only sketchy change, everything else when pretty smoothly
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.
Have you tried
await
ing afindByText
?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 did try that but the default timeout wasn't long enough π I might be able to revert to
findByText
but I think his accomplishes the same thing