import React from 'react' ; import { Document , createContext } from './DocumentNodes.story' ; import { waitFor , render } from 'design/utils/testing' ; test ( 'render DocumentNodes' , async ( ) => { const ctx = createContext ( ) ; jest . spyOn ( ctx , 'fetchClusters' ) ; jest . spyOn ( ctx , 'fetchNodes' ) ; const { container } = render ( < Document value = { ctx } / > ) ; await waitFor ( ( ) => expect ( ctx . fetchClusters ) . toHaveBeenCalledTimes ( 1 ) ) ; await waitFor ( ( ) => expect ( ctx . fetchNodes ) . toHaveBeenCalledTimes ( 1 ) ) ; expect ( container . firstChild ) . toMatchSnapshot ( ) ; } ) ;