import ReactDOM from "react-dom" ; import React from "react" ; import delay from "delay" ; const Test = require ( "./ssr/Test" ) ; const html = `<% GENERATED-HTML %>` ; describe ( "SSR" , ( ) => { it ( "should render with the defaults first, then hydrate properly" , async ( ) => { document . body . insertAdjacentHTML ( "afterbegin" , `<div id="app">${ html }</div>` ) ; const app = document . getElementById ( "app" ) ; if ( app === null ) { throw new Error ( "#app not found" ) ; } ReactDOM . hydrate ( < Test />, app); expect ( app . textContent ) . toBe ( `1x2` ) ; await delay ( 100 ) ; expect ( app . textContent ) . toBe ( `100x200` ) ; } ) ; } ) ;