test: clear remaining line broad matchers · openclaw/openclaw@aa4c68b
shakkernerd
·
2026-05-10
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -609,13 +609,12 @@ describe("handleLineWebhookEvents", () => {
|
609 | 609 | }); |
610 | 610 | |
611 | 611 | expect(processMessage).not.toHaveBeenCalled(); |
612 | | -expect(upsertPairingRequestMock).toHaveBeenCalledWith( |
613 | | -expect.objectContaining({ |
614 | | -channel: "line", |
615 | | -id: "user-5", |
616 | | -accountId: "default", |
617 | | -}), |
618 | | -); |
| 612 | +const pairingRequest = upsertPairingRequestMock.mock.calls[0]?.[0] as |
| 613 | +| { accountId?: string; channel?: string; id?: string } |
| 614 | +| undefined; |
| 615 | +expect(pairingRequest?.channel).toBe("line"); |
| 616 | +expect(pairingRequest?.id).toBe("user-5"); |
| 617 | +expect(pairingRequest?.accountId).toBe("default"); |
619 | 618 | }); |
620 | 619 | |
621 | 620 | it("does not authorize DM senders from another account's pairing-store entries", async () => { |
@@ -657,13 +656,12 @@ describe("handleLineWebhookEvents", () => {
|
657 | 656 | |
658 | 657 | expect(readAllowFromStoreMock).toHaveBeenCalledWith("line", undefined, "work"); |
659 | 658 | expect(processMessage).not.toHaveBeenCalled(); |
660 | | -expect(upsertPairingRequestMock).toHaveBeenCalledWith( |
661 | | -expect.objectContaining({ |
662 | | -channel: "line", |
663 | | -id: "cross-account-user", |
664 | | -accountId: "work", |
665 | | -}), |
666 | | -); |
| 659 | +const pairingRequest = upsertPairingRequestMock.mock.calls[0]?.[0] as |
| 660 | +| { accountId?: string; channel?: string; id?: string } |
| 661 | +| undefined; |
| 662 | +expect(pairingRequest?.channel).toBe("line"); |
| 663 | +expect(pairingRequest?.id).toBe("cross-account-user"); |
| 664 | +expect(pairingRequest?.accountId).toBe("work"); |
667 | 665 | }); |
668 | 666 | |
669 | 667 | it("deduplicates replayed webhook events by webhookEventId before processing", async () => { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -12,12 +12,11 @@ describe("LineConfigSchema", () => {
|
12 | 12 | if (result.success) { |
13 | 13 | throw new Error("Expected config validation to fail"); |
14 | 14 | } |
15 | | -expect(result.error.issues).toEqual([ |
16 | | -expect.objectContaining({ |
17 | | -path: ["allowFrom"], |
18 | | -message: 'channels.line.dmPolicy="open" requires channels.line.allowFrom to include "*"', |
19 | | -}), |
20 | | -]); |
| 15 | +expect(result.error.issues).toHaveLength(1); |
| 16 | +expect(result.error.issues[0]?.path).toEqual(["allowFrom"]); |
| 17 | +expect(result.error.issues[0]?.message).toBe( |
| 18 | +'channels.line.dmPolicy="open" requires channels.line.allowFrom to include "*"', |
| 19 | +); |
21 | 20 | }); |
22 | 21 | |
23 | 22 | it('accepts dmPolicy="open" with wildcard allowFrom', () => { |
@@ -45,11 +44,10 @@ describe("LineConfigSchema", () => {
|
45 | 44 | if (result.success) { |
46 | 45 | throw new Error("Expected account config validation to fail"); |
47 | 46 | } |
48 | | -expect(result.error.issues).toEqual([ |
49 | | -expect.objectContaining({ |
50 | | -path: ["accounts", "work", "allowFrom"], |
51 | | -message: 'channels.line.dmPolicy="open" requires channels.line.allowFrom to include "*"', |
52 | | -}), |
53 | | -]); |
| 47 | +expect(result.error.issues).toHaveLength(1); |
| 48 | +expect(result.error.issues[0]?.path).toEqual(["accounts", "work", "allowFrom"]); |
| 49 | +expect(result.error.issues[0]?.message).toBe( |
| 50 | +'channels.line.dmPolicy="open" requires channels.line.allowFrom to include "*"', |
| 51 | +); |
54 | 52 | }); |
55 | 53 | }); |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -464,14 +464,12 @@ describe("linePlugin gateway.startAccount", () => {
|
464 | 464 | }); |
465 | 465 | |
466 | 466 | await vi.waitFor(() => { |
467 | | -expect(monitorLineProvider).toHaveBeenCalledWith( |
468 | | -expect.objectContaining({ |
469 | | -channelAccessToken: "token", |
470 | | -channelSecret: "secret", |
471 | | -accountId: "default", |
472 | | -}), |
473 | | -); |
| 467 | +expect(monitorLineProvider).toHaveBeenCalledTimes(1); |
474 | 468 | }); |
| 469 | +const startupParams = monitorLineProvider.mock.calls[0]?.[0]; |
| 470 | +expect(startupParams?.channelAccessToken).toBe("token"); |
| 471 | +expect(startupParams?.channelSecret).toBe("secret"); |
| 472 | +expect(startupParams?.accountId).toBe("default"); |
475 | 473 | |
476 | 474 | abort.abort(); |
477 | 475 | await task; |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。