Skip to content

Commit 5aecfa9

Browse files
committed
Add a regression test for the object-literal case
walkConsumed() already handles a callback nested inside an ObjectExpression, added alongside the array/spread fix, but nothing exercised that branch. Add a test, and confirm it fails when the branch is disabled. Assisted-by: Claude Code:claude-sonnet-5
1 parent e4c56f6 commit 5aecfa9

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

‎packages/lint/src/tests/outbox-listener-delivery-required.test.ts‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,6 +1198,28 @@ federation
11981198
}),
11991199
);
12001200

1201+
test(
1202+
`${ruleName}: ✅ Good - awaited callback nested inside an object literal property`,
1203+
lintTest({
1204+
code: `
1205+
import { Activity } from "@fedify/vocab";
1206+
1207+
federation
1208+
.setOutboxListeners("/users/{identifier}/outbox")
1209+
.on(Activity, async (ctx, activity) => {
1210+
const sender = { identifier: ctx.identifier };
1211+
await Promise.all(
1212+
Object.values({
1213+
a: inboxes.map((inbox) => ctx.sendActivity(sender, inbox, activity)),
1214+
}),
1215+
);
1216+
});
1217+
`,
1218+
rule,
1219+
ruleName,
1220+
}),
1221+
);
1222+
12011223
test(
12021224
`${ruleName}: ✅ Good - callback passed to a bare forEach that is never awaited`,
12031225
lintTest({

0 commit comments

Comments
 (0)