File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
src/ui/public/visualize/components Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change 19
19
20
20
jest . useFakeTimers ( ) ;
21
21
22
+ import { promisify } from 'util' ;
22
23
import React from 'react' ;
23
24
import { render , mount } from 'enzyme' ;
24
25
import { VisualizationChart } from './visualization_chart' ;
25
26
26
27
let renderPromise ;
27
28
29
+ const nextTick = promisify ( process . nextTick ) ;
30
+
28
31
class VisualizationStub {
29
32
constructor ( el , vis ) {
30
33
this . el = el ;
@@ -70,6 +73,7 @@ describe('<VisualizationChart/>', () => {
70
73
71
74
jest . runAllTimers ( ) ;
72
75
await renderPromise ;
76
+ await nextTick ( ) ;
73
77
expect ( renderStart ) . toHaveBeenCalledTimes ( 1 ) ;
74
78
expect ( renderComplete ) . toHaveBeenCalledTimes ( 1 ) ;
75
79
@@ -89,12 +93,14 @@ describe('<VisualizationChart/>', () => {
89
93
domNode . addEventListener ( 'renderComplete' , renderComplete ) ;
90
94
jest . runAllTimers ( ) ;
91
95
await renderPromise ;
96
+ await nextTick ( ) ;
92
97
expect ( renderComplete ) . toHaveBeenCalledTimes ( 1 ) ;
93
98
94
99
vis . params . markdown = 'new text' ;
95
100
wrapper . setProps ( { vis } ) ;
96
101
jest . runAllTimers ( ) ;
97
102
await renderPromise ;
103
+ await nextTick ( ) ;
98
104
99
105
expect ( wrapper . find ( '.visChart' ) . text ( ) ) . toBe ( 'new text' ) ;
100
106
expect ( renderComplete ) . toHaveBeenCalledTimes ( 2 ) ;
You can’t perform that action at this time.
0 commit comments