@@ -108,16 +108,21 @@ describe('SidebarLinksData', () => {
108
108
// When the SidebarLinks are rendered without a specified report ID.
109
109
LHNTestUtils . getDefaultRenderedSidebarLinks ( ) ;
110
110
const report = createReport ( ) ;
111
+
111
112
// And the Onyx state is initialized with a report.
112
113
await initializeState ( {
113
114
[ `${ ONYXKEYS . COLLECTION . REPORT } ${ report . reportID } ` ] : report ,
114
115
} ) ;
116
+
115
117
// Then no other reports should be displayed in the sidebar.
116
118
expect ( getOptionRows ( ) ) . toHaveLength ( 0 ) ;
119
+
117
120
// When the SidebarLinks are rendered again with the current active report ID.
118
121
LHNTestUtils . getDefaultRenderedSidebarLinks ( report . reportID ) ;
122
+
119
123
// Then the active report should be displayed as part of LHN,
120
124
expect ( getOptionRows ( ) ) . toHaveLength ( 1 ) ;
125
+
121
126
// And the active report should be highlighted.
122
127
// TODO add the proper assertion for the highlighted report.
123
128
} ) ;
@@ -129,16 +134,20 @@ describe('SidebarLinksData', () => {
129
134
...createReport ( false , [ 1 , 2 ] , 0 ) ,
130
135
writeCapability : CONST . REPORT . WRITE_CAPABILITIES . ALL ,
131
136
} ;
137
+
132
138
// And Onyx state is initialized with a draft report.
133
139
await initializeState ( {
134
140
[ `${ ONYXKEYS . COLLECTION . REPORT } ${ draftReport . reportID } ` ] : draftReport ,
135
141
} ) ;
136
142
137
143
await waitForBatchedUpdatesWithAct ( ) ;
144
+
138
145
// And a draft message is added to the report.
139
146
await Onyx . merge ( `${ ONYXKEYS . COLLECTION . REPORT_DRAFT_COMMENT } ${ draftReport . reportID } ` , 'draft report message' ) ;
147
+
140
148
// Then the sidebar should display the draft report.
141
149
expect ( getDisplayNames ( ) ) . toHaveLength ( 1 ) ;
150
+
142
151
// And the draft icon should be shown, indicating there is unsent content.
143
152
expect ( screen . getByTestId ( 'Pencil Icon' ) ) . toBeOnTheScreen ( ) ;
144
153
} ) ;
@@ -147,18 +156,22 @@ describe('SidebarLinksData', () => {
147
156
// When the SidebarLinks are rendered.
148
157
LHNTestUtils . getDefaultRenderedSidebarLinks ( ) ;
149
158
const report = createReport ( false ) ;
159
+
150
160
// And the report is initialized in Onyx.
151
161
await initializeState ( {
152
162
[ `${ ONYXKEYS . COLLECTION . REPORT } ${ report . reportID } ` ] : report ,
153
163
} ) ;
164
+
154
165
// Then the report should not appear in the sidebar as it is not pinned.
155
166
expect ( getOptionRows ( ) ) . toHaveLength ( 0 ) ;
156
-
157
167
await waitForBatchedUpdatesWithAct ( ) ;
168
+
158
169
// When the report is marked as pinned.
159
170
await Onyx . merge ( `${ ONYXKEYS . COLLECTION . REPORT } ${ report . reportID } ` , { isPinned : true } ) ;
171
+
160
172
// Then the report should appear in the sidebar because it’s pinned.
161
173
expect ( getOptionRows ( ) ) . toHaveLength ( 1 ) ;
174
+
162
175
// TODO add the proper assertion for the pinned report.
163
176
} ) ;
164
177
} ) ;
@@ -168,10 +181,12 @@ describe('SidebarLinksData', () => {
168
181
// When the SidebarLinks are rendered.
169
182
LHNTestUtils . getDefaultRenderedSidebarLinks ( ) ;
170
183
const report = LHNTestUtils . getFakeReport ( [ ] ) ;
184
+
171
185
// And a report with no participants is initialized in Onyx.
172
186
await initializeState ( {
173
187
[ `${ ONYXKEYS . COLLECTION . REPORT } ${ report . reportID } ` ] : report ,
174
188
} ) ;
189
+
175
190
// Then the report should not appear in the sidebar.
176
191
expect ( getOptionRows ( ) ) . toHaveLength ( 0 ) ;
177
192
} ) ;
@@ -180,10 +195,12 @@ describe('SidebarLinksData', () => {
180
195
// When the SidebarLinks are rendered.
181
196
LHNTestUtils . getDefaultRenderedSidebarLinks ( ) ;
182
197
const report = LHNTestUtils . getFakeReport ( [ 1 , 2 ] , 0 ) ;
198
+
183
199
// And a report with no messages is initialized in Onyx
184
200
await initializeState ( {
185
201
[ `${ ONYXKEYS . COLLECTION . REPORT } ${ report . reportID } ` ] : report ,
186
202
} ) ;
203
+
187
204
// Then the empty report should not appear in the sidebar.
188
205
expect ( getOptionRows ( ) ) . toHaveLength ( 0 ) ;
189
206
} ) ;
0 commit comments