summaryrefslogtreecommitdiff
path: root/node_modules/wrangler/templates/init-tests/test-vitest-new-worker.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/wrangler/templates/init-tests/test-vitest-new-worker.js')
-rw-r--r--node_modules/wrangler/templates/init-tests/test-vitest-new-worker.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/node_modules/wrangler/templates/init-tests/test-vitest-new-worker.js b/node_modules/wrangler/templates/init-tests/test-vitest-new-worker.js
new file mode 100644
index 0000000..9e120f1
--- /dev/null
+++ b/node_modules/wrangler/templates/init-tests/test-vitest-new-worker.js
@@ -0,0 +1,24 @@
+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!"`);
+ }
+ });
+});