fix: apply test fixes and shell conventions from #1358 (#1394)

Applied the test fixes from PR #1358:

1. Fixed process.stdout.columns mutation in commands-compact-list.test.ts
   - Replaced direct property assignments with Object.defineProperty
   - Created setColumns() helper function for strict mode compatibility
   - Removed duplicate setTerminalWidth() function

2. Updated oracle-provider-patterns.test.ts assertion
   - Changed from checking for "claude.ai/install.sh" URL
   - Now checks for "install_claude_code" function name
   - Matches current oracle/claude.sh implementation

Note: Shell scripts (aws/gptme.sh, gcp/gptme.sh) already have
set -eo pipefail from previous commits - no changes needed.

Fixes #1365

Agent: code-health

Co-authored-by: B <6723574+louisgv@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
A 2026-02-17 04:59:27 -08:00 committed by GitHub
parent e55cd149c2
commit 27e7f32da3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 34 additions and 51 deletions

View file

@ -195,16 +195,22 @@ describe("Compact List View", () => {
afterEach(() => {
global.fetch = originalFetch;
if (originalColumns !== undefined) {
Object.defineProperty(process.stdout, 'columns', {
value: originalColumns,
writable: true,
configurable: true
});
}
Object.defineProperty(process.stdout, "columns", {
value: originalColumns,
writable: true,
configurable: true,
});
restoreMocks(consoleMocks.log, consoleMocks.error);
});
function setColumns(cols: number | undefined) {
Object.defineProperty(process.stdout, "columns", {
value: cols,
writable: true,
configurable: true,
});
}
function setManifest(manifest: any) {
global.fetch = mock(async () => ({
ok: true,
@ -220,13 +226,6 @@ describe("Compact List View", () => {
.join("\n");
}
function setTerminalWidth(columns: number | undefined): void {
Object.defineProperty(process.stdout, 'columns', {
value: columns,
writable: true,
configurable: true
});
}
// ── View switching based on terminal width ──────────────────────────
@ -234,11 +233,7 @@ describe("Compact List View", () => {
it("should use compact view when terminal is narrow and many clouds", async () => {
await setManifest(wideManifest);
// Force narrow terminal - compact view triggered
Object.defineProperty(process.stdout, 'columns', {
value: 60,
writable: true,
configurable: true
});
setColumns(60);
await cmdMatrix();
const output = getOutput();
@ -251,11 +246,7 @@ describe("Compact List View", () => {
it("should use grid view when terminal is wide enough for small manifest", async () => {
await setManifest(mockManifest);
// Force wide terminal
Object.defineProperty(process.stdout, 'columns', {
value: 200,
writable: true,
configurable: true
});
setColumns(200);
await cmdMatrix();
const output = getOutput();
@ -270,11 +261,7 @@ describe("Compact List View", () => {
it("should default to 80 columns when process.stdout.columns is undefined", async () => {
await setManifest(wideManifest);
// Simulate no tty (columns undefined)
Object.defineProperty(process.stdout, 'columns', {
value: undefined,
writable: true,
configurable: true
});
setColumns(undefined);
await cmdMatrix();
const output = getOutput();
@ -290,11 +277,7 @@ describe("Compact List View", () => {
describe("compact view header", () => {
it("should show three column headers: Agent, Clouds, Not yet available", async () => {
await setManifest(wideManifest);
Object.defineProperty(process.stdout, 'columns', {
value: 60,
writable: true,
configurable: true
});
setColumns(60);
await cmdMatrix();
const output = getOutput();
@ -305,7 +288,7 @@ describe("Compact List View", () => {
it("should include a separator line with dashes", async () => {
await setManifest(wideManifest);
setTerminalWidth(60);
setColumns(60);
await cmdMatrix();
const output = getOutput();
@ -319,7 +302,7 @@ describe("Compact List View", () => {
describe("compact view counts", () => {
it("should show correct count for fully implemented agent", async () => {
await setManifest(wideManifest);
setTerminalWidth(60);
setColumns(60);
await cmdMatrix();
const output = getOutput();
@ -329,7 +312,7 @@ describe("Compact List View", () => {
it("should show correct count for partially implemented agent", async () => {
await setManifest(wideManifest);
setTerminalWidth(60);
setColumns(60);
await cmdMatrix();
const output = getOutput();
@ -339,7 +322,7 @@ describe("Compact List View", () => {
it("should show 0/N when agent has no implementations", async () => {
await setManifest(allMissingManifest);
setTerminalWidth(60);
setColumns(60);
await cmdMatrix();
const output = getOutput();
@ -348,7 +331,7 @@ describe("Compact List View", () => {
it("should show N/N for all agents when everything is implemented", async () => {
await setManifest(allImplementedManifest);
setTerminalWidth(60);
setColumns(60);
await cmdMatrix();
const output = getOutput();
@ -365,7 +348,7 @@ describe("Compact List View", () => {
describe("compact view missing clouds column", () => {
it("should show 'all clouds supported' when agent is fully implemented", async () => {
await setManifest(wideManifest);
setTerminalWidth(60);
setColumns(60);
await cmdMatrix();
const output = getOutput();
@ -375,7 +358,7 @@ describe("Compact List View", () => {
it("should list missing cloud names when agent is partially implemented", async () => {
await setManifest(wideManifest);
setTerminalWidth(60);
setColumns(60);
await cmdMatrix();
const output = getOutput();
@ -389,7 +372,7 @@ describe("Compact List View", () => {
it("should not list implemented clouds as missing", async () => {
await setManifest(wideManifest);
setTerminalWidth(60);
setColumns(60);
await cmdMatrix();
const output = getOutput();
@ -408,7 +391,7 @@ describe("Compact List View", () => {
it("should list all clouds as missing when agent has no implementations", async () => {
await setManifest(allMissingManifest);
setTerminalWidth(60);
setColumns(60);
await cmdMatrix();
const output = getOutput();
@ -424,7 +407,7 @@ describe("Compact List View", () => {
it("should show 'all clouds supported' for every agent when everything is implemented", async () => {
await setManifest(allImplementedManifest);
setTerminalWidth(60);
setColumns(60);
await cmdMatrix();
const output = getOutput();
@ -440,7 +423,7 @@ describe("Compact List View", () => {
describe("compact view agent names", () => {
it("should display agent display names (not keys)", async () => {
await setManifest(wideManifest);
setTerminalWidth(60);
setColumns(60);
await cmdMatrix();
const output = getOutput();
@ -454,7 +437,7 @@ describe("Compact List View", () => {
describe("footer in compact view", () => {
it("should show total implemented count", async () => {
await setManifest(wideManifest);
setTerminalWidth(60);
setColumns(60);
await cmdMatrix();
const output = getOutput();
@ -464,7 +447,7 @@ describe("Compact List View", () => {
it("should not show grid legend in compact view", async () => {
await setManifest(wideManifest);
setTerminalWidth(60);
setColumns(60);
await cmdMatrix();
const output = getOutput();
@ -475,7 +458,7 @@ describe("Compact List View", () => {
it("should show usage hints", async () => {
await setManifest(wideManifest);
setTerminalWidth(60);
setColumns(60);
await cmdMatrix();
const output = getOutput();
@ -502,7 +485,7 @@ describe("Compact List View", () => {
},
};
await setManifest(singleAgent);
setTerminalWidth(60);
setColumns(60);
await cmdMatrix();
const output = getOutput();
@ -518,7 +501,7 @@ describe("Compact List View", () => {
describe("compact view missing clouds formatting", () => {
it("should separate missing cloud names with commas", async () => {
await setManifest(wideManifest);
setTerminalWidth(60);
setColumns(60);
await cmdMatrix();
const lines = consoleMocks.log.mock.calls.map((c: any[]) => c.join(" "));

View file

@ -744,7 +744,7 @@ describe("Oracle claude.sh agent-specific patterns", () => {
});
it("should install Claude Code if not present", () => {
expect(claudeContent).toContain("claude.ai/install.sh");
expect(claudeContent).toContain("install_claude_code");
});
it("should set ANTHROPIC_BASE_URL for OpenRouter", () => {