diff --git a/test/index.spec.ts b/test/index.spec.ts deleted file mode 100644 index fbee335..0000000 --- a/test/index.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -// test/index.spec.ts -import { env, createExecutionContext, waitOnExecutionContext, SELF } from 'cloudflare:test'; -import { describe, it, expect } from 'vitest'; -import worker from '../src/index'; - -// For now, you'll need to do something like this to get a correctly-typed -// `Request` to pass to `worker.fetch()`. -const IncomingRequest = Request; - -describe('Hello World worker', () => { - it('responds with Hello World! (unit style)', async () => { - const request = new IncomingRequest('http://example.com'); - // Create an empty context to pass to `worker.fetch()`. - const ctx = createExecutionContext(); - const response = await worker.fetch(request, env, ctx); - // Wait for all `Promise`s passed to `ctx.waitUntil()` to settle before running test assertions - await waitOnExecutionContext(ctx); - expect(await response.text()).toMatchInlineSnapshot(`"Hello World!"`); - }); - - it('responds with Hello World! (integration style)', async () => { - const response = await SELF.fetch('https://example.com'); - expect(await response.text()).toMatchInlineSnapshot(`"Hello World!"`); - }); -}); diff --git a/test/tsconfig.json b/test/tsconfig.json deleted file mode 100644 index bc019a7..0000000 --- a/test/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../tsconfig.json", - "compilerOptions": { - "types": ["@cloudflare/workers-types/experimental", "@cloudflare/vitest-pool-workers"] - }, - "include": ["./**/*.ts", "../src/env.d.ts"], - "exclude": [] -} diff --git a/tsconfig.json b/tsconfig.json index 79207ab..46cf733 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -101,5 +101,7 @@ "skipLibCheck": true /* Skip type checking all .d.ts files. */ }, "exclude": ["test"], - "include": ["worker-configuration.d.ts", "src/**/*.ts"] + "include": ["worker-configuration.d.ts", + "worker/**/*.ts" + ] } diff --git a/src/index.html b/worker/index.html similarity index 100% rename from src/index.html rename to worker/index.html diff --git a/src/index.ts b/worker/index.ts similarity index 100% rename from src/index.ts rename to worker/index.ts