@@ -164,6 +164,56 @@ describe(RepoRow.name, () => {
164164 screen . getByText ( 'Error: Timed out' ) ;
165165 } ) ;
166166
167+ it ( 'can expand the repo item when succeeded and loaded' , async ( ) => {
168+ render ( {
169+ status : VariantAnalysisRepoStatus . Succeeded ,
170+ interpretedResults : [ ] ,
171+ } ) ;
172+
173+ await userEvent . click ( screen . getByRole ( 'button' , {
174+ expanded : false
175+ } ) ) ;
176+
177+ expect ( screen . getByRole ( 'button' , {
178+ expanded : true ,
179+ } ) ) . toBeInTheDocument ( ) ;
180+ } ) ;
181+
182+ it ( 'can expand the repo item when succeeded and not loaded' , async ( ) => {
183+ const { rerender } = render ( {
184+ status : VariantAnalysisRepoStatus . Succeeded ,
185+ } ) ;
186+
187+ await userEvent . click ( screen . getByRole ( 'button' , {
188+ expanded : false
189+ } ) ) ;
190+
191+ expect ( ( window as any ) . vsCodeApi . postMessage ) . toHaveBeenCalledWith ( {
192+ t : 'requestRepositoryResults' ,
193+ repositoryFullName : 'octodemo/hello-world-1' ,
194+ } ) ;
195+
196+ expect ( screen . getByRole ( 'button' , {
197+ expanded : false ,
198+ } ) ) . toBeInTheDocument ( ) ;
199+
200+ rerender (
201+ < RepoRow
202+ repository = { {
203+ id : 1 ,
204+ fullName : 'octodemo/hello-world-1' ,
205+ private : false ,
206+ } }
207+ status = { VariantAnalysisRepoStatus . Succeeded }
208+ interpretedResults = { [ ] }
209+ />
210+ ) ;
211+
212+ expect ( screen . getByRole ( 'button' , {
213+ expanded : true ,
214+ } ) ) . toBeInTheDocument ( ) ;
215+ } ) ;
216+
167217 it ( 'does not allow expanding the repo item when status is undefined' , async ( ) => {
168218 render ( {
169219 status : undefined ,
0 commit comments