import { server } from '../mocks/server' ; beforeAll ( ( ) => server . listen ( ) ) ; afterEach ( ( ) => server . resetHandlers ( ) ) ; afterAll ( ( ) => server . close ( ) ) ; describe ( 'api interaction tests' , ( ) => { test ( 'should call the mocked api' , async ( ) => { const res = await fetch ( '/' ) ; if ( ! res . ok ) { throw new Error ( 'Could not fetch' ) ; } const json = await res . json ( ) ; expect ( json ) . toMatchInlineSnapshot ( `
      Object {
        "foo": "bar",
      }
    ` ) ; } ) ; } ) ;