@@ -61,30 +61,31 @@ async function mountCodeFileTree() {
6161describe ( 'CodeFileTree' , ( ) => {
6262 it ( 'expands and collapses a directory when clicked' , async ( ) => {
6363 const wrapper = await mountCodeFileTree ( )
64+ try {
65+ await vi . waitFor ( ( ) => {
66+ expect ( wrapper . text ( ) ) . toContain ( 'constants.d.ts' )
67+ expect ( wrapper . text ( ) ) . not . toContain ( 'common.d.ts' )
68+ } )
6469
65- await vi . waitFor ( ( ) => {
66- expect ( wrapper . text ( ) ) . toContain ( 'constants.d.ts' )
67- expect ( wrapper . text ( ) ) . not . toContain ( 'common.d.ts' )
68- } )
70+ const coreButton = findDirButton ( wrapper , 'core' )
71+ expect ( coreButton ) . toBeDefined ( )
72+ await coreButton ! . trigger ( 'click' )
6973
70- const coreButton = findDirButton ( wrapper , 'core' )
71- expect ( coreButton ) . toBeDefined ( )
72- await coreButton ! . trigger ( 'click' )
74+ await vi . waitFor ( ( ) => {
75+ expect ( wrapper . text ( ) ) . not . toContain ( 'constants.d.ts' )
76+ expect ( wrapper . text ( ) ) . not . toContain ( 'common.d.ts' )
77+ } )
7378
74- await vi . waitFor ( ( ) => {
75- expect ( wrapper . text ( ) ) . not . toContain ( 'constants.d.ts' )
76- expect ( wrapper . text ( ) ) . not . toContain ( 'common.d.ts' )
77- } )
79+ const typesButton = findDirButton ( wrapper , 'types' )
80+ expect ( typesButton ) . toBeDefined ( )
81+ await typesButton ! . trigger ( 'click' )
7882
79- const typesButton = findDirButton ( wrapper , 'types' )
80- expect ( typesButton ) . toBeDefined ( )
81- await typesButton ! . trigger ( 'click' )
82-
83- await vi . waitFor ( ( ) => {
84- expect ( wrapper . text ( ) ) . toContain ( 'common.d.ts' )
85- expect ( wrapper . text ( ) ) . not . toContain ( 'constants.d.ts' )
86- } )
87-
88- wrapper . unmount ( )
83+ await vi . waitFor ( ( ) => {
84+ expect ( wrapper . text ( ) ) . toContain ( 'common.d.ts' )
85+ expect ( wrapper . text ( ) ) . not . toContain ( 'constants.d.ts' )
86+ } )
87+ } finally {
88+ wrapper . unmount ( )
89+ }
8990 } )
9091} )
0 commit comments