MCPcopy
hub / github.com/redpanda-data/console / expect

Function expect

frontend/src/utils/interpreter/helpers.ts:48–65  ·  view source on GitHub ↗
(testOrName: string | (() => boolean), test?: () => boolean)

Source from the content-addressed store, hash-verified

46export function expect(test: () => boolean): void;
47export function expect(name: string, test: () => boolean): void;
48export function expect(testOrName: string | (() => boolean), test?: () => boolean) {
49 // biome-ignore lint/style/noNonNullAssertion: test related, will remove soon with Vitest
50 const testFunc = typeof testOrName === 'function' ? (testOrName as () => boolean) : test!;
51
52 const name = typeof testOrName === 'string' ? (testOrName as string) : null;
53
54 if (testFunc()) {
55 successfulTests += 1;
56 return; // Success
57 }
58
59 // Failed!
60 throw new Error(`
61Test failed ${name ? `: ${name}` : ''}
62 ${testFunc.toString()}
63
64`);
65}

Calls 1

toStringMethod · 0.80

Tested by 4

setPipelineNameViaDialogFunction · 0.68
performCreateActionFunction · 0.68
createScramUserFunction · 0.68
openDeleteDropdownFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…