MCPcopy
hub / github.com/holaboss-ai/holaOS / expect

Function expect

sdk/app-builder-sdk/reference/slack-messaging/e2e.ts:119–133  ·  view source on GitHub ↗
(actual: T)

Source from the content-addressed store, hash-verified

117function when(s: string) { console.log(` When ${s}`) }
118function then(s: string) { console.log(` Then ${s}`) }
119function expect<T>(actual: T) {
120 return {
121 toBe(expected: T, label = "value") {
122 if (actual !== expected) throw new Error(
123 `${label}: expected ${JSON.stringify(expected)}, got ${JSON.stringify(actual)}`)
124 },
125 toBeTruthy(label = "value") {
126 if (!actual) throw new Error(`${label}: expected truthy, got ${JSON.stringify(actual)}`)
127 },
128 toMatch(re: RegExp, label = "value") {
129 if (typeof actual !== "string" || !re.test(actual))
130 throw new Error(`${label}: expected to match ${re}, got ${JSON.stringify(actual)}`)
131 },
132 }
133}
134
135// Specialized assertion for action results — if the action failed, includes
136// the full fail.code + message in the error so we don't have to guess.

Calls

no outgoing calls

Tested by

no test coverage detected