fix(FN-4624): fix TypeScript errors in test file
Fusion-Task-Id: FN-4624 Fusion-Task-Lineage: 854e6033-bc17-45be-8d04-18bcb66b31c4
This commit is contained in:
committed by
gsxdsm
parent
5e6d420d71
commit
7851f44a58
@@ -63,14 +63,14 @@ const {
|
||||
|
||||
function mockExecOk(stdout: string): void {
|
||||
execMock.mockImplementation(((cmd: string, _opts: unknown, cb: unknown) => {
|
||||
const callback = typeof _opts === "function" ? _opts : cb;
|
||||
const callback = typeof _opts === "function" ? _opts as (...args: unknown[]) => void : cb as (...args: unknown[]) => void;
|
||||
callback(null, { stdout, stderr: "" });
|
||||
}) as unknown as typeof execImport);
|
||||
}
|
||||
|
||||
function mockExecFail(error: Error): void {
|
||||
execMock.mockImplementation(((cmd: string, _opts: unknown, cb: unknown) => {
|
||||
const callback = typeof _opts === "function" ? _opts : cb;
|
||||
const callback = typeof _opts === "function" ? _opts as (...args: unknown[]) => void : cb as (...args: unknown[]) => void;
|
||||
callback(error);
|
||||
}) as unknown as typeof execImport);
|
||||
}
|
||||
@@ -78,7 +78,7 @@ function mockExecFail(error: Error): void {
|
||||
function mockExecSequence(responses: Array<{ stdout?: string; error?: Error }>): void {
|
||||
let i = 0;
|
||||
execMock.mockImplementation(((_cmd: string, _opts: unknown, cb: unknown) => {
|
||||
const callback = typeof _opts === "function" ? _opts : cb;
|
||||
const callback = typeof _opts === "function" ? _opts as (...args: unknown[]) => void : cb as (...args: unknown[]) => void;
|
||||
const resp = responses[Math.min(i++, responses.length - 1)];
|
||||
if (resp.error) {
|
||||
callback(resp.error);
|
||||
@@ -155,7 +155,7 @@ function makeGateContext(disposition: "allow" | "block" | "require-approval"): A
|
||||
agentName: "Test Agent",
|
||||
isEphemeral: false,
|
||||
permissionPolicy: {
|
||||
defaultDisposition: disposition,
|
||||
presetId: "custom",
|
||||
rules: {
|
||||
command_execution: "allow",
|
||||
git_write: "allow",
|
||||
|
||||
Reference in New Issue
Block a user