-
Notifications
You must be signed in to change notification settings - Fork 29
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
Move some App.test.tsx helpers to utils #2056
Conversation
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 job, you've taken about 500 lines off of the file! I spotted a couple of typos, but overall, it looks good to me!
renderTable(sortingTableDataFixture) | ||
} | ||
|
||
export const renderTableWithoutRuningExperiments = () => { |
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.
Did you mean renderTableWithoutRunningExperiments
?
renderTable({ ...tableDataFixture, rows: [tableDataFixture.rows[0]] }) | ||
} | ||
|
||
export const renderTableWithSortingdata = () => { |
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.
Did you mean renderTableWithSortingData
?
getCountIndicators, | ||
renderTable, | ||
renderTableWithNoColumns, | ||
renderTableWithoutRuningExperiments, |
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.
Running
renderTableWithNoColumns, | ||
renderTableWithoutRuningExperiments, | ||
renderTableWithPlaceholder, | ||
renderTableWithSortingdata, |
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.
SortingData
const tailRow = within(getRow('42b8736')).getByRole('checkbox') | ||
fireEvent.click(tailRow, { shiftKey: true }) | ||
clickRowCheckbox('4fb124a') | ||
clickRowCheckbox('42b8736', true) | ||
|
||
const selectedRows = screen.getAllByRole('row', { selected: 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.
[C] This could be a helper as well:
const selectedRows = (screen) => screen.getAllByRole('row', { selected: 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.
or import screen into the utils file.
@@ -0,0 +1,87 @@ | |||
/* eslint-disable unicorn/filename-case */ |
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.
In theory, it should already be in the ignore pattern of the rule (all files in test folders are ignored for PascalCase rule, but I think we had that because we used to have something like util.tsx
. I'm torn between fixing the rule so that your file gets ignored and you can remove that line and just using PascalCase here (and even removing the ignore pattern on the test files).
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 forgot about this issue!
I prefer to ignore the rule for cases like this (not just tests).
My reason is that a PascalCase implies that the file is either a component (Like IconMenu.tsx) or a family of related components (like Row(s).tsx).
But for buildDynamicColumns.tsx and this file the jsx code is just ancillary stuff.
They are not the main purpose of the file.
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.
Then it should be in the ignore pattern of the rule. It is already the case, but it must be broken.
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'll add it, thanks!
6af4cda
to
e698bc9
Compare
Code Climate has analyzed commit 167cb08 and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 100.0% (85% is the threshold). This pull request will bring the total coverage in the repository to 96.7% (0.0% change). View more on Code Climate. |
Based on https://github.com/iterative/vscode-dvc/pull/2004/files#r921740235