70bf21e064
Deploy (to testing) and Test Playground Preview Worker / Deploy Playground Preview Worker (testing) (push) Has been skipped
Deploy Workers Shared Staging / Deploy Workers Shared Staging (push) Failing after 0s
Prerelease / build (push) Has been skipped
Handle Changesets / Handle Changesets (push) Has been cancelled
Semgrep OSS scan / semgrep-oss (push) Has been cancelled
12 lines
540 B
TypeScript
12 lines
540 B
TypeScript
import { exports } from "cloudflare:workers";
|
|
import { it } from "vitest";
|
|
|
|
it("dispatches fetch event", async ({ expect }) => {
|
|
// `exports.default` here points to the worker running in the current isolate.
|
|
// This gets its handler from the `main` option in `vitest.config.mts`.
|
|
// Importantly, it uses the exact `import("../src").default` instance we could
|
|
// import in this file as its handler.
|
|
const response = await exports.default.fetch("http://example.com");
|
|
expect(await response.text()).toBe("👋 http://example.com/");
|
|
});
|