mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-27 12:56:01 -06:00
test(qa): prove Slack pagination request budget
This commit is contained in:
@@ -28,6 +28,7 @@ import {
|
||||
buildSlackApprovalCheckpointMessage,
|
||||
collectSlackActionValues,
|
||||
extractSlackNativeApprovalId,
|
||||
listSlackMessages,
|
||||
runSlackTableInvalidBlocksFallbackScenario,
|
||||
} from "./slack-live.observations.js";
|
||||
import * as slackScenarioImplementations from "./slack-live.scenario-implementations.js";
|
||||
@@ -107,6 +108,32 @@ describe("Slack live QA runtime helpers", () => {
|
||||
expect(testing.resolveSlackRateLimitDelayMs(new Error("network failed"))).toBeUndefined();
|
||||
});
|
||||
|
||||
it("bounds paginated history work and surfaces Slack rate limits for poller backoff", async () => {
|
||||
const history = vi
|
||||
.fn()
|
||||
.mockResolvedValueOnce({ messages: [], response_metadata: { next_cursor: "page-2" } })
|
||||
.mockResolvedValueOnce({ messages: [], response_metadata: { next_cursor: "page-3" } })
|
||||
.mockRejectedValueOnce({ retryAfter: 10 });
|
||||
|
||||
await expect(
|
||||
listSlackMessages({
|
||||
channelId: "C123456789",
|
||||
client: { conversations: { history } } as never,
|
||||
oldestTs: "1.000000",
|
||||
}),
|
||||
).rejects.toEqual({ retryAfter: 10 });
|
||||
expect(history).toHaveBeenCalledTimes(3);
|
||||
|
||||
history.mockReset();
|
||||
history.mockResolvedValue({ messages: [], response_metadata: { next_cursor: "more" } });
|
||||
await listSlackMessages({
|
||||
channelId: "C123456789",
|
||||
client: { conversations: { history } } as never,
|
||||
oldestTs: "1.000000",
|
||||
});
|
||||
expect(history).toHaveBeenCalledTimes(5);
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
vi.useRealTimers();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user