* feat(guidance): search bundled REA workflow guidance * fix(guidance): address review findings * test(guidance): fix boundary and dispatcher coverage * test(setup): use supported doctor fixture runtime * fix(guidance): resolve CI conformance, coverage, and review findings * fix(guidance): own complete requests through shutdown * test(guidance): bound lifecycle gates and join failed work --------- Co-authored-by: Deepak-Kambala <[email protected]> Co-authored-by: gensokyo-dev <[email protected]>
40 lines
1.3 KiB
TypeScript
40 lines
1.3 KiB
TypeScript
import { afterEach, expect, it, vi } from "vitest";
|
|
import { closeCliResources } from "../../../src/cli.js";
|
|
import * as javascript from "../../../src/cli/javascriptApplicationAnalysis.js";
|
|
import * as guidance from "../../../src/cli/guidanceCommands.js";
|
|
|
|
afterEach(() => vi.restoreAllMocks());
|
|
|
|
it.each([
|
|
[false, false],
|
|
[true, false],
|
|
[false, true],
|
|
[true, true],
|
|
])(
|
|
"settles both CLI owners when JavaScript fails=%s and guidance fails=%s",
|
|
async (jsFails, guideFails) => {
|
|
const jsError = new Error("JavaScript resources retained");
|
|
const guideError = new Error("Guidance descriptor retained");
|
|
const js = vi
|
|
.spyOn(javascript, "closeCliJavaScriptResources")
|
|
.mockImplementation(async () => {
|
|
if (jsFails) throw jsError;
|
|
});
|
|
const guides = vi
|
|
.spyOn(guidance, "closeCliGuidanceResources")
|
|
.mockImplementation(async () => {
|
|
if (guideFails) throw guideError;
|
|
});
|
|
const closing = closeCliResources();
|
|
if (jsFails && guideFails)
|
|
await expect(closing).rejects.toMatchObject({
|
|
errors: [jsError, guideError],
|
|
});
|
|
else if (jsFails || guideFails)
|
|
await expect(closing).rejects.toBe(jsFails ? jsError : guideError);
|
|
else await expect(closing).resolves.toBeUndefined();
|
|
expect(js).toHaveBeenCalledOnce();
|
|
expect(guides).toHaveBeenCalledOnce();
|
|
},
|
|
);
|