chore: consolidate model utils and drive-by cleanups (#476)
Signed-off-by: Thibault Sottiaux <tibo@openai.com>
This commit is contained in:
committed by
GitHub
parent
dc276999a9
commit
3c4f1fea9b
@@ -50,7 +50,7 @@ vi.mock("openai", () => {
|
||||
|
||||
// The AgentLoop pulls these helpers in order to decide whether a command can
|
||||
// be auto‑approved. None of that matters for this test, so we stub the module
|
||||
// with minimal no‑op implementations.
|
||||
// with minimal no-op implementations.
|
||||
vi.mock("../src/approvals.js", () => {
|
||||
return {
|
||||
__esModule: true,
|
||||
|
||||
@@ -79,7 +79,7 @@ describe("canAutoApprove()", () => {
|
||||
test("true command is considered safe", () => {
|
||||
expect(check(["true"])).toEqual({
|
||||
type: "auto-approve",
|
||||
reason: "No‑op (true)",
|
||||
reason: "No-op (true)",
|
||||
group: "Utility",
|
||||
runInSandbox: false,
|
||||
});
|
||||
|
||||
@@ -26,7 +26,7 @@ vi.mock("fs", async () => {
|
||||
memfs[path] = data;
|
||||
},
|
||||
mkdirSync: () => {
|
||||
// no‑op in in‑memory store
|
||||
// no-op in in‑memory store
|
||||
},
|
||||
rmSync: (path: string) => {
|
||||
// recursively delete any key under this prefix
|
||||
|
||||
@@ -44,7 +44,7 @@ describe("model-utils – offline resilience", () => {
|
||||
"../src/utils/model-utils.js"
|
||||
);
|
||||
|
||||
const supported = await isModelSupportedForResponses("o4-mini");
|
||||
const supported = await isModelSupportedForResponses("openai", "o4-mini");
|
||||
expect(supported).toBe(true);
|
||||
});
|
||||
|
||||
@@ -63,8 +63,11 @@ describe("model-utils – offline resilience", () => {
|
||||
"../src/utils/model-utils.js"
|
||||
);
|
||||
|
||||
// Should resolve true despite the network failure
|
||||
const supported = await isModelSupportedForResponses("some-model");
|
||||
// Should resolve true despite the network failure.
|
||||
const supported = await isModelSupportedForResponses(
|
||||
"openai",
|
||||
"some-model",
|
||||
);
|
||||
expect(supported).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -57,7 +57,7 @@ async function type(
|
||||
await flush();
|
||||
}
|
||||
|
||||
/** Build a set of no‑op callbacks so <TerminalChatInput> renders with minimal
|
||||
/** Build a set of no-op callbacks so <TerminalChatInput> renders with minimal
|
||||
* scaffolding.
|
||||
*/
|
||||
function stubProps(): any {
|
||||
|
||||
@@ -127,7 +127,7 @@ describe("TextBuffer – basic editing parity with Rust suite", () => {
|
||||
expect(buf.getCursor()).toEqual([0, 2]); // after 'b'
|
||||
});
|
||||
|
||||
it("is a no‑op at the very beginning of the buffer", () => {
|
||||
it("is a no-op at the very beginning of the buffer", () => {
|
||||
const buf = new TextBuffer("ab");
|
||||
buf.backspace(); // caret starts at (0,0)
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ vi.mock("../src/components/select-input/select-input.js", () => {
|
||||
|
||||
// Ink's <TextInput> toggles raw‑mode which calls .ref() / .unref() on stdin.
|
||||
// The test environment's mock streams don't implement those methods, so we
|
||||
// polyfill them to no‑ops on the prototype *before* the component tree mounts.
|
||||
// polyfill them to no-ops on the prototype *before* the component tree mounts.
|
||||
import { EventEmitter } from "node:events";
|
||||
if (!(EventEmitter.prototype as any).ref) {
|
||||
(EventEmitter.prototype as any).ref = () => {};
|
||||
|
||||
Reference in New Issue
Block a user