[AI-assisted] test: fix typing and test fixture issues (#31444)

* test: fix typing and test fixture issues

* Fix type-test harness issues from session routing and mock typing

* Add routing regression test for session.mainKey precedence
This commit is contained in:
Vincent Koc
2026-03-02 00:41:21 -08:00
committed by GitHub
parent 1443bb9a84
commit 29c3ce9454
13 changed files with 195 additions and 104 deletions

View File

@@ -113,7 +113,6 @@ describe("registerSlackMemberEvents", () => {
calls: 0,
},
];
it.each(cases)("$name", async ({ args, calls }) => {
await runMemberCase(args);
expect(memberMocks.enqueue).toHaveBeenCalledTimes(calls);

View File

@@ -131,7 +131,6 @@ describe("registerSlackMessageEvents", () => {
calls: 0,
},
];
it.each(cases)("$name", async ({ input, calls }) => {
await runMessageCase(input);
expect(messageQueueMock).toHaveBeenCalledTimes(calls);

View File

@@ -115,7 +115,6 @@ describe("registerSlackPinEvents", () => {
expectedCalls: 0,
},
];
it.each(cases)("$name", async ({ args, expectedCalls }) => {
await runPinCase(args);
expect(pinEnqueueMock).toHaveBeenCalledTimes(expectedCalls);

View File

@@ -78,20 +78,20 @@ async function executeReactionCase(input: ReactionRunInput = {}) {
}
describe("registerSlackReactionEvents", () => {
const cases: Array<{ name: string; args: ReactionRunInput; expectedCalls: number }> = [
const cases: Array<{ name: string; input: ReactionRunInput; expectedCalls: number }> = [
{
name: "enqueues DM reaction system events when dmPolicy is open",
args: { overrides: { dmPolicy: "open" } },
input: { overrides: { dmPolicy: "open" } },
expectedCalls: 1,
},
{
name: "blocks DM reaction system events when dmPolicy is disabled",
args: { overrides: { dmPolicy: "disabled" } },
input: { overrides: { dmPolicy: "disabled" } },
expectedCalls: 0,
},
{
name: "blocks DM reaction system events for unauthorized senders in allowlist mode",
args: {
input: {
overrides: { dmPolicy: "allowlist", allowFrom: ["U2"] },
event: buildReactionEvent({ user: "U1" }),
},
@@ -99,7 +99,7 @@ describe("registerSlackReactionEvents", () => {
},
{
name: "allows DM reaction system events for authorized senders in allowlist mode",
args: {
input: {
overrides: { dmPolicy: "allowlist", allowFrom: ["U1"] },
event: buildReactionEvent({ user: "U1" }),
},
@@ -107,8 +107,8 @@ describe("registerSlackReactionEvents", () => {
},
{
name: "enqueues channel reaction events regardless of dmPolicy",
args: {
handler: "removed" as const,
input: {
handler: "removed",
overrides: { dmPolicy: "disabled", channelType: "channel" },
event: {
...buildReactionEvent({ channel: "C1" }),
@@ -119,7 +119,7 @@ describe("registerSlackReactionEvents", () => {
},
{
name: "blocks channel reaction events for users outside channel users allowlist",
args: {
input: {
overrides: {
dmPolicy: "open",
channelType: "channel",
@@ -131,8 +131,8 @@ describe("registerSlackReactionEvents", () => {
},
];
it.each(cases)("$name", async ({ args, expectedCalls }) => {
await executeReactionCase(args);
it.each(cases)("$name", async ({ input, expectedCalls }) => {
await executeReactionCase(input);
expect(reactionQueueMock).toHaveBeenCalledTimes(expectedCalls);
});