export default class StubResponse implements Response { public static success ( content = '' ) { return new StubResponse ( 200 , content ) ; } public static notFound ( ) { return new StubResponse ( 404 ) ; } private content : string ; readonly body ! : ReadableStream | null ; readonly bodyUsed ! : boolean ; readonly headers ! : Headers ; readonly ok ! : boolean ; readonly redirected ! : boolean ; readonly status : number ; readonly statusText ! : string ; readonly trailer ! : Promise < Headers > ; readonly type ! : ResponseType ; readonly url ! : string ; private constructor ( status , content = '' ) { this . status = status ; this . content = content ; } public async arrayBuffer ( ) { throw new Error ( 'Method not implemented.' ) ; } public async blob ( ) { throw new Error ( 'Method not implemented.' ) ; } public async formData ( ) { throw new Error ( 'Method not implemented.' ) ; } public async json < T > ( ) { return JSON . parse ( this . content ) ; } public async text ( ) { return this . content ; } public clone ( ) { return new StubResponse ( this . status , this . content ) ; } }