diff options
| author | akiyamn | 2023-09-24 23:22:21 +1000 |
|---|---|---|
| committer | akiyamn | 2023-09-24 23:22:21 +1000 |
| commit | 4e87195739f2a5d9a05451b48773c8afdc680765 (patch) | |
| tree | 9cba501844a4a11dcbdffc4050ed8189561c55ed /node_modules/wrangler/templates/init-tests | |
| download | price-tracker-worker-4e87195739f2a5d9a05451b48773c8afdc680765.tar.gz price-tracker-worker-4e87195739f2a5d9a05451b48773c8afdc680765.zip | |
Initial commit (by create-cloudflare CLI)
Diffstat (limited to 'node_modules/wrangler/templates/init-tests')
3 files changed, 72 insertions, 0 deletions
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!"`); + } + }); +}); |
