MCPcopy Create free account
hub / github.com/Effect-TS/effect / assertThrowsTagged

Function assertThrowsTagged

packages/sql/pg/test/PgProtocol.test.ts:19–28  ·  view source on GitHub ↗
(tag: string, run: () => unknown, message?: string)

Source from the content-addressed store, hash-verified

17}
18
19const assertThrowsTagged = (tag: string, run: () => unknown, message?: string): void => {
20 try {
21 run()
22 } catch (error) {
23 assert.strictEqual((error as { readonly _tag?: string })._tag, tag)
24 if (message !== undefined) assert.strictEqual((error as Error).message, message)
25 return
26 }
27 assert.fail(`Expected ${tag}`)
28}
29
30const assertParseFailure = (golden: string): void =>
31 assertThrowsTagged("PgProtocolParseError", () => PgProtocol.makeParser().push(bytes(golden)))

Callers 2

assertParseFailureFunction · 0.70
PgProtocol.test.tsFile · 0.70

Calls 2

failMethod · 0.65
runFunction · 0.50

Tested by

no test coverage detected