mirror of
https://github.com/JonasunderscoreJones/api-worker.git
synced 2025-10-23 18:39:19 +02:00
24 lines
547 B
JavaScript
24 lines
547 B
JavaScript
import { unstable_dev } from "wrangler";
|
|
import { describe, expect, it, beforeAll, afterAll } from "vitest";
|
|
|
|
describe("Worker", () => {
|
|
let worker;
|
|
|
|
beforeAll(async () => {
|
|
worker = await unstable_dev("src/index.js", {
|
|
experimental: { disableExperimentalWarning: true },
|
|
});
|
|
});
|
|
|
|
afterAll(async () => {
|
|
await worker.stop();
|
|
});
|
|
|
|
it("should return Hello World", async () => {
|
|
const resp = await worker.fetch();
|
|
if (resp) {
|
|
const text = await resp.text();
|
|
expect(text).toMatchInlineSnapshot(`"Hello World!"`);
|
|
}
|
|
});
|
|
});
|