Przeglądaj źródła

test: harden OpenCode detection fixture

Alvin Unreal 2 tygodni temu
rodzic
commit
7cb98ff17f
1 zmienionych plików z 2 dodań i 9 usunięć
  1. 2 9
      src/cli/system.test.ts

+ 2 - 9
src/cli/system.test.ts

@@ -1,13 +1,7 @@
 /// <reference types="bun-types" />
 
 import { describe, expect, mock, test } from 'bun:test';
-import {
-  chmodSync,
-  mkdirSync,
-  mkdtempSync,
-  rmSync,
-  writeFileSync,
-} from 'node:fs';
+import { mkdirSync, mkdtempSync, rmSync, symlinkSync } from 'node:fs';
 import { tmpdir } from 'node:os';
 import { join } from 'node:path';
 import {
@@ -24,8 +18,7 @@ describe('system', () => {
     try {
       const opencodePath = join(dir, '.opencode', 'bin', 'opencode');
       mkdirSync(join(dir, '.opencode', 'bin'), { recursive: true });
-      writeFileSync(opencodePath, '#!/bin/sh\necho 1.2.3\n');
-      chmodSync(opencodePath, 0o755);
+      symlinkSync(process.execPath, opencodePath, 'file');
 
       expect(
         await isOpenCodeInstalled({