Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Commit

Permalink
migrates from router to endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
jonfriesen committed Jan 5, 2024
1 parent 40f3a59 commit e92584f
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 24 deletions.
28 changes: 13 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"vitest": "^1.1.1"
},
"dependencies": {
"@qpoint/router": "^0.2.1",
"@qpoint/endpoint": "^0.0.1",
"@qpoint/htmlrewriter": "^0.0.1"
}
}
10 changes: 5 additions & 5 deletions src/endpoint-harness.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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 = {
Expand Down
6 changes: 3 additions & 3 deletions tests/endpoint-harness.test.ts
Original file line number Diff line number Diff line change
@@ -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');

Expand All @@ -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();
Expand Down

0 comments on commit e92584f

Please sign in to comment.