Skip to content

Commit 1e3c007

Browse files
committed
Fix linting
1 parent 435e431 commit 1e3c007

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

workers/watcher/test/index.spec.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
1-
import { SELF, env, fetchMock } from "cloudflare:test";
2-
import { beforeAll, afterEach, it, expect, vi } from "vitest";
1+
import { SELF, fetchMock } from "cloudflare:test";
2+
import { beforeAll, afterEach, it, expect } from "vitest";
33

44
// For now, you'll need to do something like this to get a correctly-typed
55
// `Request` to pass to `worker.fetch()`.
66
// const IncomingRequest = Request<unknown, IncomingRequestCfProperties>;
77

88
beforeAll(() => {
9-
fetchMock.activate();
9+
fetchMock.activate();
1010
});
1111
afterEach(() => {
12-
fetchMock.assertNoPendingInterceptors();
12+
fetchMock.assertNoPendingInterceptors();
1313
});
1414

1515
it("forwards every request to the controller", async () => {
16-
const sendSpy = vi
17-
.spyOn(env.CACHE_CONTROLLER, "fetch")
18-
.mockResolvedValue(new Response());
16+
// Mock the first request to `https://example.com`
17+
fetchMock
18+
.get("https://example.com")
19+
.intercept({ path: "/" })
20+
.reply(200, "body");
1921

20-
await SELF.fetch("https://example.com");
22+
const response = await SELF.fetch("https://example.com");
2123

22-
expect(sendSpy).toBeCalled();
24+
expect(await response.text()).toBe("body");
2325
});

0 commit comments

Comments
 (0)