test(image-analysis): cover runtime auth and fallback

This commit is contained in:
Tam Nhu Tran committed 2026-04-02 15:44:13 -04:00
1 parent 813b2dd4d0
commit f379a4001f
15 files changed
+1077 -52

No files matched your search

@@ -171,7 +171,7 @@ describe('image-analysis routes', () => {
expect.objectContaining({
name: 'glm',
target: 'claude',
currentTargetMode: 'setup',
currentTargetMode: 'fallback',
}),
expect.objectContaining({
name: 'codexProfile',
@@ -12,9 +12,17 @@ function writeJson(filePath: string, value: Record<string, unknown>): void {
}
function installSharedHook(tempHome: string): string {
const hookPath = path.join(tempHome, '.ccs', 'hooks', 'image-analyzer-transformer.cjs');
fs.mkdirSync(path.dirname(hookPath), { recursive: true });
fs.writeFileSync(hookPath, '#!/usr/bin/env node\n', 'utf8');
const hooksDir = path.join(tempHome, '.ccs', 'hooks');
fs.mkdirSync(hooksDir, { recursive: true });
for (const fileName of ['image-analyzer-transformer.cjs', 'image-analysis-runtime.cjs']) {
fs.copyFileSync(
path.join(process.cwd(), 'lib', 'hooks', fileName),
path.join(hooksDir, fileName)
);
}
const hookPath = path.join(hooksDir, 'image-analyzer-transformer.cjs');
return hookPath;
}