chore: resolve unbound-method lint warnings in tests (#12204)

Capture jest mock references in local variables instead of asserting
against unbound method references on mocked classes/instances.

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Tom Moor
2026-04-28 20:50:25 -04:00
committed by GitHub
parent e29c9102af
commit 4c85c4d08d
4 changed files with 27 additions and 35 deletions
@@ -5,9 +5,11 @@ import WebhookProcessor from "./WebhookProcessor";
jest.mock("../tasks/DeliverWebhookTask");
const ip = "127.0.0.1";
const schedule = jest.fn();
beforeEach(() => {
jest.resetAllMocks();
DeliverWebhookTask.prototype.schedule = schedule;
});
describe("WebhookProcessor", () => {
@@ -29,12 +31,8 @@ describe("WebhookProcessor", () => {
await processor.perform(event);
expect(
jest.mocked(DeliverWebhookTask.prototype.schedule)
).toHaveBeenCalled();
expect(
jest.mocked(DeliverWebhookTask.prototype.schedule)
).toHaveBeenCalledWith({
expect(schedule).toHaveBeenCalled();
expect(schedule).toHaveBeenCalledWith({
event,
subscriptionId: subscription.id,
});
@@ -57,9 +55,7 @@ describe("WebhookProcessor", () => {
await processor.perform(event);
expect(
jest.mocked(DeliverWebhookTask.prototype.schedule)
).toHaveBeenCalledTimes(0);
expect(schedule).toHaveBeenCalledTimes(0);
});
it("it schedules a delivery for the event for each subscription", async () => {
@@ -85,21 +81,13 @@ describe("WebhookProcessor", () => {
await processor.perform(event);
expect(
jest.mocked(DeliverWebhookTask.prototype.schedule)
).toHaveBeenCalled();
expect(
jest.mocked(DeliverWebhookTask.prototype.schedule)
).toHaveBeenCalledTimes(2);
expect(
jest.mocked(DeliverWebhookTask.prototype.schedule)
).toHaveBeenCalledWith({
expect(schedule).toHaveBeenCalled();
expect(schedule).toHaveBeenCalledTimes(2);
expect(schedule).toHaveBeenCalledWith({
event,
subscriptionId: subscription.id,
});
expect(
jest.mocked(DeliverWebhookTask.prototype.schedule)
).toHaveBeenCalledWith({
expect(schedule).toHaveBeenCalledWith({
event,
subscriptionId: subscriptionTwo.id,
});