diff --git a/package-lock.json b/package-lock.json index 6ef2a12..6a13187 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,19 +1,19 @@ { "name": "@qpoint/testing", - "version": "0.0.7", + "version": "0.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@qpoint/testing", - "version": "0.0.7", + "version": "0.0.0", "license": "Apache-2.0", "dependencies": { - "@qpoint/router": "^0.2.1" + "@qpoint/endpoint": "^0.0.1", + "@qpoint/htmlrewriter": "^0.0.1" }, "devDependencies": { "@cloudflare/workers-types": "^4.20231218.0", - "@qpoint/htmlrewriter": "^0.0.1", "typescript": "^5.3.3", "vitest": "^1.1.1" } @@ -410,23 +410,22 @@ "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", "dev": true }, + "node_modules/@qpoint/endpoint": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/@qpoint/endpoint/-/endpoint-0.0.1.tgz", + "integrity": "sha512-JMBqvVeFwNt1o/pzw5Lgy37KQSiFDP5aAkpAd9+zmA2T8G/RNQ5X8bANq0TibojfqUXjgg1HtBLhTrDvktvjoQ==", + "dependencies": { + "koa-compose": "^4.1.0" + } + }, "node_modules/@qpoint/htmlrewriter": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/@qpoint/htmlrewriter/-/htmlrewriter-0.0.1.tgz", "integrity": "sha512-s8tAdsi0qLAGyrvTA0TNpxHvHF8iw8RWuoSb3UWdeHbef9+9Tcob+TYiHNYvWFui2pt+Rn1C3QxVhtGOie8QYw==", - "dev": true, "dependencies": { "htmlrewriter": "^0.0.4" } }, - "node_modules/@qpoint/router": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/@qpoint/router/-/router-0.2.1.tgz", - "integrity": "sha512-SmVeGCPMrKsR3xzKeGdvUYRKS9Zcl7AVcwzpdl6G0Ycw24iZvCxFFx4X1mMpv0tVAHXK6CgkW/y88R2MxIIYEQ==", - "dependencies": { - "koa-compose": "^4.1.0" - } - }, "node_modules/@rollup/rollup-android-arm-eabi": { "version": "4.9.2", "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.9.2.tgz", @@ -902,8 +901,7 @@ "node_modules/htmlrewriter": { "version": "0.0.4", "resolved": "https://registry.npmjs.org/htmlrewriter/-/htmlrewriter-0.0.4.tgz", - "integrity": "sha512-zfU0WUhJMH85vvS4bE5A2DwiMIgF4fI5lkMIDDE4wDC7LCS1Z6IGOyEsjZcjzgJ+A/tQZ4WSsaE9qPIjbaVKgQ==", - "dev": true + "integrity": "sha512-zfU0WUhJMH85vvS4bE5A2DwiMIgF4fI5lkMIDDE4wDC7LCS1Z6IGOyEsjZcjzgJ+A/tQZ4WSsaE9qPIjbaVKgQ==" }, "node_modules/human-signals": { "version": "5.0.0", diff --git a/package.json b/package.json index 322fa96..f693402 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "vitest": "^1.1.1" }, "dependencies": { - "@qpoint/router": "^0.2.1", + "@qpoint/endpoint": "^0.0.1", "@qpoint/htmlrewriter": "^0.0.1" } } diff --git a/src/endpoint-harness.ts b/src/endpoint-harness.ts index 30c4768..1567aca 100644 --- a/src/endpoint-harness.ts +++ b/src/endpoint-harness.ts @@ -1,10 +1,10 @@ -import Router, { Context } from '@qpoint/router'; +import Endpoint, { Context } from '@qpoint/endpoint'; import { Queue } from './queue'; import '@qpoint/htmlrewriter'; /** - * The `EndpointHarness` class is designed for testing Qpoint middleware. It features a router - * instance from '@qpoint/router' to route requests and a queue to track and manage background + * The `EndpointHarness` class is designed for testing Qpoint middleware. It features a endpoint + * instance from '@qpoint/endpoint' to route requests and a queue to track and manage background * asynchronous tasks, ensuring their completion before moving forward. * * The class's primary functionalities include adding middleware using the `use()` method, @@ -28,14 +28,14 @@ import '@qpoint/htmlrewriter'; * ``` */ export class EndpointHarness { - endpoint: Router; + endpoint: Endpoint; req: Request; ctx: ExecutionContext; queue: Queue; reqCtx: Context; constructor() { - this.endpoint = new Router(); + this.endpoint = new Endpoint(); this.req = new Request('http://example.com'); this.queue = new Queue(); this.ctx = { diff --git a/tests/endpoint-harness.test.ts b/tests/endpoint-harness.test.ts index e439d81..eee509c 100644 --- a/tests/endpoint-harness.test.ts +++ b/tests/endpoint-harness.test.ts @@ -1,9 +1,9 @@ import { describe, it, expect, vi, afterEach } from 'vitest'; import { EndpointHarness } from '../src/endpoint-harness'; import { Queue } from '../src/queue'; -import Router, { Context } from '@qpoint/router'; +import Endpoint, { Context } from '@qpoint/endpoint'; -vi.mock('@qpoint/router'); +vi.mock('@qpoint/endpoint'); vi.mock('htmlrewriter'); vi.mock('./queue'); @@ -14,7 +14,7 @@ describe('EndpointHarness', () => { it('should initialize with default values', () => { const harness = new EndpointHarness(); - expect(harness.endpoint).toBeInstanceOf(Router); + expect(harness.endpoint).toBeInstanceOf(Endpoint); expect(harness.req).toBeInstanceOf(Request); expect(harness.queue).toBeInstanceOf(Queue); expect(harness.ctx).toBeDefined();