-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(error): adjust path to mocked module for
req
-> request
refa…
…ctor
- Loading branch information
1 parent
f6bd63d
commit f1dae9c
Showing
1 changed file
with
3 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -249,7 +249,7 @@ describe('Request properties', () => { | |
assert(!response.ok) | ||
}) | ||
it('should derive hostname from the :authority header and assign it to req.hostname', async () => { | ||
const { getRequestHeader }: typeof reqGetHeader = await vi.importActual('@/packages/req/src/get-header') | ||
const { getRequestHeader }: typeof reqGetHeader = await vi.importActual('@/packages/request/src/get-header') | ||
vi.mocked(reqGetHeader.getRequestHeader).mockImplementation((req: Request, header: string) => { | ||
if (header === 'host') return undefined | ||
if (header === ':authority') return '[email protected]:8080' | ||
|
@@ -273,7 +273,7 @@ describe('Request properties', () => { | |
await fetch('/', { headers: { Host: 'foo.bar:8080' } }).expect(200, { port: 8080 }) | ||
}) | ||
it('should derive port from the :authority header and assign it to req.port', async () => { | ||
const { getRequestHeader }: typeof reqGetHeader = await vi.importActual('@/packages/req/src/get-header') | ||
const { getRequestHeader }: typeof reqGetHeader = await vi.importActual('@/packages/request/src/get-header') | ||
vi.mocked(reqGetHeader.getRequestHeader).mockImplementation((req: Request, header: string) => { | ||
if (header === 'host') return undefined | ||
if (header === ':authority') return 'bar.baz:8080' | ||
|
@@ -291,7 +291,7 @@ describe('Request properties', () => { | |
await expect(response.json()).resolves.toEqual({ port: 8080 }) | ||
}) | ||
it('should reject request when the :authority header disagrees with the host header', async () => { | ||
const { getRequestHeader }: typeof reqGetHeader = await vi.importActual('@/packages/req/src/get-header') | ||
const { getRequestHeader }: typeof reqGetHeader = await vi.importActual('@/packages/request/src/get-header') | ||
vi.mocked(reqGetHeader.getRequestHeader).mockImplementation((req: Request, header: string) => { | ||
if (header === 'host') return 'foo.bar' | ||
if (header === ':authority') return 'bar.baz' | ||
|