Skip to content
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 unit tests for common sidebar functionality #10619

Merged
merged 45 commits into from
Aug 31, 2022
Merged
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
f61d54b
Add skeleton unit test
tgolen Aug 27, 2022
ab12338
Switch test rendering lib
tgolen Aug 27, 2022
9aa11a1
Get component to render inside a test
tgolen Aug 27, 2022
596d17a
Struggle rendering icon
tgolen Aug 27, 2022
278605d
Fix errors for rendering an SVG
tgolen Aug 28, 2022
0234575
Get the tests passing
tgolen Aug 28, 2022
c0259be
Add comments to the tests
tgolen Aug 28, 2022
40c2cad
Cleanup tests and clear onyx after each test
tgolen Aug 28, 2022
f5aabd3
Remove unnecessary onyx key for preferred locale
tgolen Aug 28, 2022
3fdd8a0
Test that one report is showing in the list
tgolen Aug 28, 2022
aca004b
Have test verify no items were rendered
tgolen Aug 28, 2022
cfd7e37
Remove unused import
tgolen Aug 28, 2022
0173c33
Add a way to supprest proptype warnings
tgolen Aug 28, 2022
0e3e13d
Switch to a better method for checking array length
tgolen Aug 28, 2022
4779610
Add a test for the order of reports
tgolen Aug 28, 2022
ece7808
Remove nested promises
tgolen Aug 28, 2022
0b914d6
Change participant names to identify the reports
tgolen Aug 28, 2022
c618fed
Add a test for draft comments on the active report
tgolen Aug 28, 2022
e58c132
Merge branch 'main' into tgolen-test-sidebarlinks
tgolen Aug 29, 2022
6590435
WIP trying to get context providers to work
tgolen Aug 29, 2022
33b19e0
WIP trying to get context providers to work
tgolen Aug 29, 2022
4ed2bff
Get the context provider working
tgolen Aug 29, 2022
9d59462
Pass a string for reportID instead of a number
tgolen Aug 29, 2022
07c5cfd
Add a test for the pencil icon
tgolen Aug 29, 2022
720b875
Get the tests working for reports with drafts
tgolen Aug 29, 2022
115854c
Split up the tests so they are smaller
tgolen Aug 29, 2022
2a7f583
Add a test for new comments added to active report
tgolen Aug 30, 2022
2815b5a
Add a test for switching chats while a report has a draft
tgolen Aug 30, 2022
e37356d
Add a test for switching chats while a report has a draft
tgolen Aug 30, 2022
dd447ea
Add a test for the removal of the pencil icon
tgolen Aug 30, 2022
6a5c8e2
Add a test for keeping draft reports on top
tgolen Aug 30, 2022
7e525cd
Add a test for page refresh
tgolen Aug 30, 2022
3f7ee72
Fix broken test
tgolen Aug 30, 2022
545991d
Merge branch 'main' into tgolen-test-sidebarlinks
tgolen Aug 30, 2022
ac12528
Refactor tests for removing of draft onyx key
tgolen Aug 30, 2022
9b81d5a
Fix a bad merge conflict
tgolen Aug 30, 2022
14ee46d
Fix some proptype warnings
tgolen Aug 30, 2022
19b2e43
Simplify the hasDraftComment property
tgolen Aug 30, 2022
21a1c6a
WIP to fix broken test
tgolen Aug 30, 2022
e6e9a18
Add a comment about why the test doesn't work
tgolen Aug 30, 2022
b97e5b1
Merge branch 'main' into tgolen-test-sidebarlinks
tgolen Aug 30, 2022
38f8541
Move accessability hint onto the icon component
tgolen Aug 30, 2022
394f30d
Fix lint errors
tgolen Aug 30, 2022
e92e258
Update src/pages/home/sidebar/SidebarLinks.js
tgolen Aug 31, 2022
e464e8e
Remove unnecessary disable of automocking
tgolen Aug 31, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add a test for the pencil icon
  • Loading branch information
tgolen committed Aug 29, 2022
commit 07c5cfd72d9fca2e8902bd09bbd7cdeb876edfb8
4 changes: 3 additions & 1 deletion tests/unit/LHNOrderTest.js
Original file line number Diff line number Diff line change
@@ -209,10 +209,12 @@ describe('Sidebar', () => {
[`${ONYX_KEYS.COLLECTION.REPORTS_WITH_DRAFT}1`]: true,
}))

// THEN the order of the reports should not change and
// THEN there should be a pencil icon and the order of the reports should not change
.then(() => {
const reportOptions = sidebarLinks.getAllByText(/ReportID, (One|Two)/);
expect(reportOptions).toHaveLength(2);
const pencilIcon = sidebarLinks.getAllByText('Pencil');
expect(pencilIcon).toHaveLength(1);

// reportID=2 should be first (on the top) since it has the most recent lastMessageTimestamp
expect(reportOptions[0].children[0].props.children).toBe('ReportID, Two');