Mail relay: docs, agent guide, skills, changelog draft; test against the real service code; starter offers the mail service
Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.2
parent
533f571d4d
commit
dd3792cbc7
+5
-4
@@ -30,7 +30,7 @@ export const nextHeadersMock = {
|
||||
|
||||
export type TestServer = { close: () => Promise<void>; url: string }
|
||||
|
||||
export async function startPayloadServer(config: Promise<SanitizedConfig>): Promise<TestServer> {
|
||||
export async function startPayloadServer(config: Promise<SanitizedConfig>, port = 0): Promise<TestServer> {
|
||||
const rest = { DELETE: REST_DELETE(config), GET: REST_GET(config), PATCH: REST_PATCH(config), POST: REST_POST(config) }
|
||||
const graphql = GRAPHQL_POST(config)
|
||||
|
||||
@@ -76,12 +76,13 @@ export async function startPayloadServer(config: Promise<SanitizedConfig>): Prom
|
||||
})()
|
||||
})
|
||||
})
|
||||
await new Promise<void>((resolve) => server.listen(0, '127.0.0.1', resolve))
|
||||
// a fixed port listens on every local address: `localhost` may be ::1 for whoever calls back
|
||||
await new Promise<void>((resolve) => (port ? server.listen(port, resolve) : server.listen(0, '127.0.0.1', resolve)))
|
||||
const address = server.address()
|
||||
const port = typeof address === 'object' && address ? address.port : 0
|
||||
const listening = typeof address === 'object' && address ? address.port : 0
|
||||
return {
|
||||
close: () => new Promise<void>((resolve) => server.close(() => resolve())),
|
||||
url: `http://127.0.0.1:${port}`,
|
||||
url: `http://127.0.0.1:${listening}`,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user