Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

test: resolve the long temp path for the Recycle Bin smoke (#12325)

Adam Eivy9a369608ab6b
diff --git a/server/lib/nativeTrash.smoke.test.js b/server/lib/nativeTrash.smoke.test.js
index 16783bafa7..2386aca208 100644
--- a/server/lib/nativeTrash.smoke.test.js
+++ b/server/lib/nativeTrash.smoke.test.js
@@ -3,7 +3,7 @@
// the shipped windows-trash.exe, and a developer's real bin must stay untouched
// unless they set PORTOS_NATIVE_TRASH_SMOKE themselves.
import { afterEach, describe, expect, it } from 'vitest';
-import { mkdtemp, readdir, readFile, rm, stat, unlink, writeFile } from 'node:fs/promises';
+import { mkdtemp, readdir, readFile, realpath, rm, stat, unlink, writeFile } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import { join, parse } from 'node:path';
import { execFileSync } from './childProcess.js';
@@ -29,7 +29,8 @@ describe.runIf(process.platform === 'win32' && process.env.PORTOS_NATIVE_TRASH_S
});
it('recycles a temp file and leaves a $I record naming its original path', async () => {
- dir = await mkdtemp(join(tmpdir(), 'portos-native-trash-smoke-'));
+ // The shell records the long form; the runner's tmpdir is an 8.3 short path.
+ dir = await mkdtemp(join(await realpath.native(tmpdir()), 'portos-native-trash-smoke-'));
const file = join(dir, 'smoke target.txt');
await writeFile(file, 'native trash smoke');
const sid = execFileSync('whoami', ['/user', '/fo', 'csv', '/nh'], { encoding: 'utf8', windowsHide: true })
@@ -39,10 +40,13 @@ describe.runIf(process.platform === 'win32' && process.env.PORTOS_NATIVE_TRASH_S
await moveToNativeTrash([file]);
await expect(stat(file)).rejects.toMatchObject({ code: 'ENOENT' });
+ const seen = [];
for (const name of await readdir(binDir)) {
if (!name.startsWith('$I')) continue;
- if (readOriginalPath(await readFile(join(binDir, name))).toLowerCase() === file.toLowerCase()) infoFile = join(binDir, name);
+ const original = readOriginalPath(await readFile(join(binDir, name)));
+ seen.push(original);
+ if (original.toLowerCase() === file.toLowerCase()) infoFile = join(binDir, name);
}
- expect(infoFile, 'a $I record naming the recycled path').toBeDefined();
+ expect(infoFile, `a $I record naming ${file}; bin holds ${JSON.stringify(seen)}`).toBeDefined();
});
});