@@ -162,9 +162,20 @@ describe('<LegacyLibMigrationPage />', () => {
162162 } ) ;
163163
164164 it ( 'should back to select legacy libraries' , async ( ) => {
165+ const user = userEvent . setup ( ) ;
165166 renderPage ( ) ;
166- expect ( await screen . findByText ( 'Migrate Legacy Libraries' ) ) . toBeInTheDocument ( ) ;
167+ // The filter is Unmigrated by default
168+ const filterButton = await screen . findByRole ( 'button' , { name : / u n m i g r a t e d / i } ) ;
169+ expect ( filterButton ) . toBeInTheDocument ( ) ;
170+
171+ // Clear filter to show all
172+ await user . click ( filterButton ) ;
173+ const clearButton = await screen . findByRole ( 'button' , { name : / c l e a r f i l t e r / i } ) ;
174+ await user . click ( clearButton ) ;
175+
167176 expect ( await screen . findByText ( 'MBA' ) ) . toBeInTheDocument ( ) ;
177+ expect ( await screen . findByText ( 'Legacy library 1' ) ) . toBeInTheDocument ( ) ;
178+ expect ( await screen . findByText ( 'MBA 1' ) ) . toBeInTheDocument ( ) ;
168179
169180 const legacyLibrary = screen . getByRole ( 'checkbox' , { name : 'MBA' } ) ;
170181 legacyLibrary . click ( ) ;
@@ -178,7 +189,13 @@ describe('<LegacyLibMigrationPage />', () => {
178189 const backButton = screen . getByRole ( 'button' , { name : / b a c k / i } ) ;
179190 backButton . click ( ) ;
180191
192+ // The selected legacy library remains checked
193+ expect ( legacyLibrary ) . toBeChecked ( ) ;
194+
195+ // The filter remains the same
181196 expect ( await screen . findByText ( 'MBA' ) ) . toBeInTheDocument ( ) ;
197+ expect ( await screen . findByText ( 'Legacy library 1' ) ) . toBeInTheDocument ( ) ;
198+ expect ( await screen . findByText ( 'MBA 1' ) ) . toBeInTheDocument ( ) ;
182199 } ) ;
183200
184201 it ( 'should select a library destination' , async ( ) => {
@@ -230,6 +247,8 @@ describe('<LegacyLibMigrationPage />', () => {
230247 backButton . click ( ) ;
231248
232249 expect ( await screen . findByText ( 'Test Library 1' ) ) . toBeInTheDocument ( ) ;
250+ // The selected v2 library remains checked
251+ expect ( radioButton ) . toBeChecked ( ) ;
233252 } ) ;
234253
235254 it ( 'should open the create new library modal' , async ( ) => {
0 commit comments