From 4e87195739f2a5d9a05451b48773c8afdc680765 Mon Sep 17 00:00:00 2001 From: akiyamn Date: Sun, 24 Sep 2023 23:22:21 +1000 Subject: Initial commit (by create-cloudflare CLI) --- .../templates/init-tests/test-jest-new-worker.js | 23 ++++++++++++++++++++ .../templates/init-tests/test-vitest-new-worker.js | 24 +++++++++++++++++++++ .../templates/init-tests/test-vitest-new-worker.ts | 25 ++++++++++++++++++++++ 3 files changed, 72 insertions(+) create mode 100644 node_modules/wrangler/templates/init-tests/test-jest-new-worker.js create mode 100644 node_modules/wrangler/templates/init-tests/test-vitest-new-worker.js create mode 100644 node_modules/wrangler/templates/init-tests/test-vitest-new-worker.ts (limited to 'node_modules/wrangler/templates/init-tests') diff --git a/node_modules/wrangler/templates/init-tests/test-jest-new-worker.js b/node_modules/wrangler/templates/init-tests/test-jest-new-worker.js new file mode 100644 index 0000000..d33aa91 --- /dev/null +++ b/node_modules/wrangler/templates/init-tests/test-jest-new-worker.js @@ -0,0 +1,23 @@ +const { unstable_dev } = require("wrangler"); + +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!"`); + } + }); +}); 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!"`); + } + }); +}); diff --git a/node_modules/wrangler/templates/init-tests/test-vitest-new-worker.ts b/node_modules/wrangler/templates/init-tests/test-vitest-new-worker.ts new file mode 100644 index 0000000..974364b --- /dev/null +++ b/node_modules/wrangler/templates/init-tests/test-vitest-new-worker.ts @@ -0,0 +1,25 @@ +import { unstable_dev } from "wrangler"; +import type { UnstableDevWorker } from "wrangler"; +import { describe, expect, it, beforeAll, afterAll } from "vitest"; + +describe("Worker", () => { + let worker: UnstableDevWorker; + + beforeAll(async () => { + worker = await unstable_dev("src/index.ts", { + 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!"`); + } + }); +}); -- cgit v1.2.3