All files / src/transports SpyingTransport.ts

100% Statements 4/4
100% Branches 1/1
100% Functions 2/2
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15          47x   47x     45x 45x      
import { Response } from 'node-fetch';
import { PetStoreRequests } from '../requests/PetstoreRequest.js';
import { Transport } from './Transport.js';
 
export class SpyingTransport implements Transport {
  hasBeenExecuted = false;
 
  constructor(public responseToReturn: Response = null) {}
 
  async execute(_request: PetStoreRequests): Promise<Response> {
    this.hasBeenExecuted = true;
    return Promise.resolve(this.responseToReturn);
  }
}