Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/openstatusHQ/openstatus. ๐ซ Status page with uptime monitoring & API monitoring as code ๐ซ openstatus.dev
bun drizzle-orm monitoring monitoring-as-code nextjs observability on-call open-source shadcn-ui status-page statuspage synthetic-monitoring tinybird turso uptime uptime-checker uptime-monitor
Something went wrong. Try again.
TypeScript
at incident-api
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162// Mutable per-test config shared by the slack module doubles below. Replaces// the per-file bun `mock.module` closures (handler.test / interactions.test):// each test sets the fields it needs in beforeEach and reads `calls`.type SlackCall = { method: string; args: Record<string, unknown> };type Override = ((args: Record<string, unknown>) => Promise<unknown>) | null;
export interface SlackTestState { resolveWorkspace: (teamId: string) => Promise<unknown>; calls: SlackCall[]; postMessageOverride: Override; updateOverride: Override; postEphemeralOverride: Override; sessionStatusOverride: Override; renameOverride: Override; /** Set to false to simulate a workspace/SDK without message streaming. */ chatStreamEnabled: boolean; /** Make appends start throwing once this many have succeeded. */ streamAppendFailAfter: number | null; /** Make `stop` reject, as Slack does once it has closed the stream itself. */ streamStopFail: boolean; /** Receives runAgent's options, so a test can drive the stream or abort. */ runAgentOverride: ((options?: unknown) => Promise<unknown>) | null; repliesImpl: (args?: Record<string, unknown>) => Promise<unknown>; historyImpl: () => Promise<unknown>; /** `users.info` result; the default has no email, so no mapping is created. */ usersInfoImpl: (args: Record<string, unknown>) => Promise<unknown>; /** `reactions.get` result; the default message has no reactions. */ reactionsGetImpl: (args: Record<string, unknown>) => Promise<unknown>; /** `conversations.info` result; the default channel has no name. */ conversationsInfoImpl: (args: Record<string, unknown>) => Promise<unknown>;}
const g = globalThis as Record<string, unknown>;if (!g.__slackTestState) { g.__slackTestState = { resolveWorkspace: () => Promise.resolve(null), calls: [], postMessageOverride: null, updateOverride: null, postEphemeralOverride: null, sessionStatusOverride: null, renameOverride: null, chatStreamEnabled: true, streamAppendFailAfter: null, streamStopFail: false, runAgentOverride: null, repliesImpl: () => Promise.resolve({ messages: [{ user: "U1", text: "test message", ts: "1.1" }], }), historyImpl: () => Promise.resolve({ messages: [{ user: "U1", text: "channel message", ts: "1.1" }], }), usersInfoImpl: () => Promise.resolve({ ok: true, user: { profile: {} } }), reactionsGetImpl: () => Promise.resolve({ ok: true, message: {} }), conversationsInfoImpl: () => Promise.resolve({ ok: true, channel: {} }), } satisfies SlackTestState;}
export const slackTestState = g.__slackTestState as SlackTestState;