import * as SUT from '../index' ; import { Page } from 'playwright' ; describe ( 'on request to respond with' , ( ) : void => { beforeEach ( ( ) : void => { } ) ; test ( 'should return an error when browser has not been launched' , async ( ) : Promise < void > => { const page = undefined ; const options = { } ; const response = { } ; const expectedError = new Error ( "Cannot intercept requests to '/foobar' because no browser has been launched" ) ; await SUT . onRequestToRespondWith ( '/foobar' , options , response , page ) . catch ( ( error ) : void => expect ( error ) . toMatchObject ( expectedError ) ) ; } ) ; } ) ;