File tree Expand file tree Collapse file tree 1 file changed +18
-6
lines changed
packages/bridge/bridge-react/__tests__ Expand file tree Collapse file tree 1 file changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -66,8 +66,12 @@ describe('bridge', () => {
6666 ) ;
6767 expect ( getHtml ( container ) ) . toMatch ( 'loading' ) ;
6868
69- await sleep ( 200 ) ;
70- expect ( getHtml ( container ) ) . toMatch ( 'life cycle render' ) ;
69+ await waitFor (
70+ ( ) => {
71+ expect ( getHtml ( container ) ) . toMatch ( 'life cycle render' ) ;
72+ } ,
73+ { timeout : 1000 } ,
74+ ) ;
7175 expect ( getHtml ( container ) ) . toMatch ( 'hello world' ) ;
7276 } ) ;
7377
@@ -97,8 +101,12 @@ describe('bridge', () => {
97101 ) ;
98102 expect ( getHtml ( container ) ) . toMatch ( 'loading' ) ;
99103
100- await sleep ( 200 ) ;
101- expect ( getHtml ( container ) ) . toMatch ( 'life cycle render' ) ;
104+ await waitFor (
105+ ( ) => {
106+ expect ( getHtml ( container ) ) . toMatch ( 'life cycle render' ) ;
107+ } ,
108+ { timeout : 1000 } ,
109+ ) ;
102110 expect ( getHtml ( container ) ) . toMatch ( 'hello world' ) ;
103111 expect ( ref . current ) . not . toBeNull ( ) ;
104112 } ) ;
@@ -131,7 +139,11 @@ describe('bridge', () => {
131139 const { container } = render ( < RemoteComponent /> ) ;
132140 expect ( getHtml ( container ) ) . toMatch ( 'loading' ) ;
133141
134- await sleep ( 200 ) ;
135- expect ( renderMock ) . toHaveBeenCalledTimes ( 1 ) ;
142+ await waitFor (
143+ ( ) => {
144+ expect ( renderMock ) . toHaveBeenCalledTimes ( 1 ) ;
145+ } ,
146+ { timeout : 1000 } ,
147+ ) ;
136148 } ) ;
137149} ) ;
You can’t perform that action at this time.
0 commit comments