openclaw/extensions/slack/test-api.test.ts
Peter Steinberger fb8bd5e07b
test(qa): preload the Slack action graph before scenario deadlines (#138681)
* test(qa): preload the Slack action graph before scenario deadlines

The qa-lab Slack runtime suite proves the public send path through
`@openclaw/slack/test-api.js`, whose `sendSlackMessage` is a lazy runtime
loader: the first call dynamically imports `extensions/slack/src/actions.js`
and its whole send graph. That cold import ran inside the first sending
test's 120s Vitest deadline (about 4s locally, unbounded on a contended
CI shard). `checks-node-changed-extensions-config-48` timed out in
"proves the public Slack send path stores complete ordered fallback chunks"
on #137506 attempts 12 and 13 while the same code passed on attempt 14.

Export `preloadSlackActions` from the Slack test API and warm the graph in
`beforeAll`, outside scenario deadlines, mirroring the session-tools fixture
preparation from #137743. The lazy loader itself stays lazy for the Jiti
runtime path. Locally the fallback test drops from ~3.9s to 13ms.

* test(slack): admit the preload export in the test API surface contract
2026-09-04 17:20:57 -07:00

19 lines
653 B
TypeScript

// Slack test API tests enforce the narrow private-QA runtime surface.
import { describe, expect, it } from "vitest";
import * as slackQaRuntime from "./test-api.js";
describe("Slack test API", () => {
it("exports exactly the Slack operations owned by private QA", () => {
expect(Object.keys(slackQaRuntime).toSorted()).toEqual([
"createSlackWebClient",
"createSlackWriteClient",
"listSlackReactions",
"preloadSlackActions",
"resolveSlackWebClientOptions",
"sendSlackMessage",
]);
for (const operation of Object.values(slackQaRuntime)) {
expect(operation).toBeTypeOf("function");
}
});
});