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', () => {
66
66
) ;
67
67
expect ( getHtml ( container ) ) . toMatch ( 'loading' ) ;
68
68
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
+ ) ;
71
75
expect ( getHtml ( container ) ) . toMatch ( 'hello world' ) ;
72
76
} ) ;
73
77
@@ -97,8 +101,12 @@ describe('bridge', () => {
97
101
) ;
98
102
expect ( getHtml ( container ) ) . toMatch ( 'loading' ) ;
99
103
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
+ ) ;
102
110
expect ( getHtml ( container ) ) . toMatch ( 'hello world' ) ;
103
111
expect ( ref . current ) . not . toBeNull ( ) ;
104
112
} ) ;
@@ -131,7 +139,11 @@ describe('bridge', () => {
131
139
const { container } = render ( < RemoteComponent /> ) ;
132
140
expect ( getHtml ( container ) ) . toMatch ( 'loading' ) ;
133
141
134
- await sleep ( 200 ) ;
135
- expect ( renderMock ) . toHaveBeenCalledTimes ( 1 ) ;
142
+ await waitFor (
143
+ ( ) => {
144
+ expect ( renderMock ) . toHaveBeenCalledTimes ( 1 ) ;
145
+ } ,
146
+ { timeout : 1000 } ,
147
+ ) ;
136
148
} ) ;
137
149
} ) ;
You can’t perform that action at this time.
0 commit comments