test: speed up slow vitest hotspots

This commit is contained in:
Peter Steinberger
2026-05-01 23:13:58 +01:00
parent 0df90d9b8d
commit bc2bb10fc1
5 changed files with 77 additions and 40 deletions

View File

@@ -1602,6 +1602,7 @@ describe("active-memory plugin", () => {
it("returns partial transcript text on timeout when the subagent has already written assistant output", async () => {
__testing.setMinimumTimeoutMsForTests(1);
__testing.setSetupGraceTimeoutMsForTests(0);
api.pluginConfig = {
agents: ["main"],
timeoutMs: 20,
@@ -1664,6 +1665,7 @@ describe("active-memory plugin", () => {
it("returns partial transcript text on timeout when transcripts are temporary by default", async () => {
__testing.setMinimumTimeoutMsForTests(1);
__testing.setSetupGraceTimeoutMsForTests(0);
api.pluginConfig = {
agents: ["main"],
timeoutMs: 20,
@@ -1719,6 +1721,7 @@ describe("active-memory plugin", () => {
it("keeps timeout status when the timeout transcript is empty", async () => {
__testing.setMinimumTimeoutMsForTests(1);
__testing.setSetupGraceTimeoutMsForTests(0);
api.pluginConfig = {
agents: ["main"],
timeoutMs: 1,
@@ -1749,6 +1752,7 @@ describe("active-memory plugin", () => {
it("keeps timeout status when the timeout transcript path does not exist", async () => {
__testing.setMinimumTimeoutMsForTests(1);
__testing.setSetupGraceTimeoutMsForTests(0);
api.pluginConfig = {
agents: ["main"],
timeoutMs: 1,

View File

@@ -270,8 +270,15 @@ describe("monitorSlackProvider tool results", () => {
await flush();
}
function expectReactionNames(names: string[]) {
expect(reactMock.mock.calls.map(([args]) => (args as { name: string }).name)).toEqual(names);
function expectReactionFlow(expected: {
startsWith: string[];
endsWith: string;
includes: string;
}) {
const names = reactMock.mock.calls.map(([args]) => (args as { name: string }).name);
expect(names.slice(0, expected.startsWith.length)).toEqual(expected.startsWith);
expect(names).toContain(expected.includes);
expect(names.at(-1)).toBe(expected.endsWith);
}
async function runDefaultMessageAndExpectSentText(expectedText: string) {
@@ -694,7 +701,11 @@ describe("monitorSlackProvider tool results", () => {
await runMentionGatedChannelMessageAndFlush();
expect(sendMock).not.toHaveBeenCalled();
expectReactionNames(["eyes", "scream", "scream"]);
expectReactionFlow({
startsWith: ["eyes", "scream"],
includes: "scream",
endsWith: "scream",
});
});
it("replies with pairing code when dmPolicy is pairing and no allowFrom is set", async () => {