MCPcopy Create free account
hub / github.com/scriptscat/scriptcat / createMockResponse

Function createMockResponse

packages/filesystem/s3/s3.test.ts:22–38  ·  view source on GitHub ↗

创建 mock Response

(options: {
  ok?: boolean;
  status?: number;
  statusText?: string;
  text?: string;
  blob?: Blob;
})

Source from the content-addressed store, hash-verified

20
21/** 创建 mock Response */
22function createMockResponse(options: {
23 ok?: boolean;
24 status?: number;
25 statusText?: string;
26 text?: string;
27 blob?: Blob;
28}): Response {
29 const { ok = true, status = 200, statusText = "OK", text = "" } = options;
30 return {
31 ok,
32 status,
33 statusText,
34 headers: new Headers(),
35 text: vi.fn().mockResolvedValue(text),
36 blob: vi.fn().mockResolvedValue(options.blob ?? new Blob([text])),
37 } as unknown as Response;
38}
39
40describe("S3FileSystem", () => {
41 let mockClient: S3Client;

Callers 1

s3.test.tsFile · 0.70

Calls 1

fnMethod · 0.80

Tested by

no test coverage detected