Archived
1
0

feat: add tests for src/node/app.ts

This adds a couple tests for ensureAddress.
This commit is contained in:
Joe Previte
2021-09-03 11:41:42 -07:00
parent 8a1c129dd1
commit 09440563ca
2 changed files with 32 additions and 2 deletions

View File

@ -69,10 +69,10 @@ export const createApp = async (args: DefaultedArgs): Promise<[Express, Express,
export const ensureAddress = (server: http.Server): string => {
const addr = server.address()
if (!addr) {
throw new Error("server has no address")
throw new Error("server has no address") // NOTE@jsjoeio test this line
}
if (typeof addr !== "string") {
return `http://${addr.address}:${addr.port}`
}
return addr
return addr // NOTE@jsjoeio test this line
}