From 68180e5b440b8fa6c7459414f6983d3c57992e19 Mon Sep 17 00:00:00 2001 From: Reinier Criel Date: Fri, 12 Dec 2025 11:26:53 -0800 Subject: [PATCH] Add more tests --- test/e2e/teardown-dirs.e2e.spec.js | 40 ++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/test/e2e/teardown-dirs.e2e.spec.js b/test/e2e/teardown-dirs.e2e.spec.js index 912355f..0ed8bf6 100644 --- a/test/e2e/teardown-dirs.e2e.spec.js +++ b/test/e2e/teardown-dirs.e2e.spec.js @@ -56,4 +56,44 @@ describe("E2E: safe-chain teardown command", () => { const checkScriptsGone = await shell.runCommand("test -d ~/.safe-chain/scripts && echo 'exists' || echo 'missing'"); assert.ok(checkScriptsGone.output.includes("missing"), "Scripts directory should be removed after teardown"); }); + + it("safe-chain teardown removes shims directory created by setup-ci --include-python", async () => { + const shell = await container.openShell("bash"); + + // Run setup-ci with --include-python + await shell.runCommand("safe-chain setup-ci --include-python"); + + // Verify shims directory exists + const checkShimsExist = await shell.runCommand("test -d ~/.safe-chain/shims && echo 'exists' || echo 'missing'"); + assert.ok(checkShimsExist.output.includes("exists"), "Shims directory should exist after setup-ci --include-python"); + + // Verify Python shims were created + const checkPythonShims = await shell.runCommand("test -f ~/.safe-chain/shims/pip && echo 'exists' || echo 'missing'"); + assert.ok(checkPythonShims.output.includes("exists"), "Python shims should exist after setup-ci --include-python"); + + // Run teardown + await shell.runCommand("safe-chain teardown"); + + // Verify shims directory is gone + const checkShimsGone = await shell.runCommand("test -d ~/.safe-chain/shims && echo 'exists' || echo 'missing'"); + assert.ok(checkShimsGone.output.includes("missing"), "Shims directory should be removed after teardown"); + }); + + it("safe-chain teardown removes scripts directory created by setup --include-python", async () => { + const shell = await container.openShell("bash"); + + // Run setup with --include-python + await shell.runCommand("safe-chain setup --include-python"); + + // Verify scripts directory exists + const checkScriptsExist = await shell.runCommand("test -d ~/.safe-chain/scripts && echo 'exists' || echo 'missing'"); + assert.ok(checkScriptsExist.output.includes("exists"), "Scripts directory should exist after setup --include-python"); + + // Run teardown + await shell.runCommand("safe-chain teardown"); + + // Verify scripts directory is gone + const checkScriptsGone = await shell.runCommand("test -d ~/.safe-chain/scripts && echo 'exists' || echo 'missing'"); + assert.ok(checkScriptsGone.output.includes("missing"), "Scripts directory should be removed after teardown"); + }); });