mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 09:01:14 +00:00
test(coding-agent): fix git-update tests to use setPackages
Tests used setExtensionPaths but update() iterates packages, not extensions. All 5 non-pinned tests were silently passing as no-ops. Also add regression test for scope-aware update behavior.
This commit is contained in:
parent
cafe12b79e
commit
7f78c383c9
1 changed files with 24 additions and 3 deletions
|
|
@ -98,8 +98,8 @@ describe("DefaultPackageManager git update", () => {
|
|||
git(["config", "user.email", "test@test.com"], installedDir);
|
||||
git(["config", "user.name", "Test"], installedDir);
|
||||
|
||||
// Add to settings so update() only processes this scope
|
||||
settingsManager.setExtensionPaths([gitSource]);
|
||||
// Add to global packages so update() processes this source
|
||||
settingsManager.setPackages([gitSource]);
|
||||
}
|
||||
|
||||
describe("normal updates (no force-push)", () => {
|
||||
|
|
@ -207,7 +207,7 @@ describe("DefaultPackageManager git update", () => {
|
|||
const initialCommit = getCurrentCommit(installedDir);
|
||||
|
||||
// Reconfigure with pinned ref
|
||||
settingsManager.setExtensionPaths([`${gitSource}@${initialCommit}`]);
|
||||
settingsManager.setPackages([`${gitSource}@${initialCommit}`]);
|
||||
|
||||
// Add new commit to remote
|
||||
createCommit(remoteDir, "extension.ts", "// v2", "Second commit");
|
||||
|
|
@ -220,4 +220,25 @@ describe("DefaultPackageManager git update", () => {
|
|||
expect(getFileContent(installedDir, "extension.ts")).toBe("// v1");
|
||||
});
|
||||
});
|
||||
|
||||
describe("scope-aware update", () => {
|
||||
it("should not install locally when source is only registered globally", async () => {
|
||||
setupRemoteAndInstall();
|
||||
|
||||
// Add a new commit to remote
|
||||
createCommit(remoteDir, "extension.ts", "// v2", "Second commit");
|
||||
|
||||
// The project-scope install path should not exist before or after update
|
||||
const projectGitDir = join(tempDir, ".pi", "git", "github.com", "test", "extension");
|
||||
expect(existsSync(projectGitDir)).toBe(false);
|
||||
|
||||
await packageManager.update(gitSource);
|
||||
|
||||
// Global install should be updated
|
||||
expect(getFileContent(installedDir, "extension.ts")).toBe("// v2");
|
||||
|
||||
// Project-scope directory should NOT have been created
|
||||
expect(existsSync(projectGitDir)).toBe(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue