fix(discord): bound timeout member expiry · openclaw/openclaw@6399b6a
steipete
·
2026-05-31
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -335,6 +335,20 @@ describe("sendMessageDiscord", () => {
|
335 | 335 | expect(patchMock).not.toHaveBeenCalled(); |
336 | 336 | }); |
337 | 337 | |
| 338 | +it("rejects timeout durations that overflow from the current clock", async () => { |
| 339 | +vi.useFakeTimers(); |
| 340 | +vi.setSystemTime(new Date(8_640_000_000_000_000)); |
| 341 | +const { rest, patchMock } = makeDiscordRest(); |
| 342 | + |
| 343 | +await expect( |
| 344 | +timeoutMemberDiscord( |
| 345 | +{ guildId: "g1", userId: "u1", durationMinutes: 1 }, |
| 346 | +discordClientOpts(rest), |
| 347 | +), |
| 348 | +).rejects.toThrow("Discord timeout duration is outside the supported Date range"); |
| 349 | +expect(patchMock).not.toHaveBeenCalled(); |
| 350 | +}); |
| 351 | + |
338 | 352 | it("adds and removes roles", async () => { |
339 | 353 | const { rest, putMock, deleteMock } = makeDiscordRest(); |
340 | 354 | putMock.mockResolvedValue({}); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。