This repository has been archived by the owner on Jun 13, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support custom fallback routes
- Loading branch information
Showing
9 changed files
with
256 additions
and
69 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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { beforeAll, afterEach, expect, test } from "vitest"; | ||
import { startProxy } from "./startProxy.js"; | ||
import getPort from "get-port"; | ||
import { createPool } from "../pool/createPool.js"; | ||
import { fetchLogs } from "./fetchLogs.js"; | ||
|
||
const pool = createPool(); | ||
afterEach(async () => { | ||
await pool.empty(); | ||
}); | ||
|
||
let port: number; | ||
beforeAll(async () => { | ||
port = await getPort(); | ||
return await startProxy({ port, pool }); | ||
}); | ||
|
||
test("can fetch logs from anvil instance", async () => { | ||
await pool.start(1); | ||
await expect(fetchLogs(`http://localhost:${port}`, 1)).resolves.toMatchObject( | ||
expect.arrayContaining([ | ||
expect.stringMatching( | ||
/test test test test test test test test test test test junk/, | ||
), | ||
]), | ||
); | ||
}); | ||
|
||
test("throws if trying to fetch logs from non-existent anvil instance", async () => { | ||
await expect(fetchLogs(`http://localhost:${port}`, 123)).rejects.toThrow( | ||
"Anvil instance doesn't exist", | ||
); | ||
}); |
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
Oops, something went wrong.