test(config): add config-get tests for git.base_branch

Add two config-get tests to verify the git.base_branch round-trip:
- config-get returns the value after config-set stores it
- config-get errors with "Key not found" when git.base_branch is not
  explicitly set (default config omits it), which triggers the
  auto-detect fallback via origin/HEAD in workflows

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Tibsfox
2026-03-29 14:41:32 -07:00
parent 0fb992d151
commit 3cf5355c8c

View File

@@ -339,6 +339,27 @@ describe('config-get command', () => {
});
});
test('gets git.base_branch after it is set', () => {
runGsdTools('config-set git.base_branch master', tmpDir);
const result = runGsdTools('config-get git.base_branch', tmpDir);
assert.ok(result.success, `Command failed: ${result.error}`);
const output = JSON.parse(result.output);
assert.strictEqual(output, 'master');
});
test('errors for git.base_branch when not explicitly set', () => {
// Default config from config-ensure-section does not include git.base_branch,
// so config-get should return "Key not found" — this triggers auto-detect
// fallback in the workflow (origin/HEAD detection).
const result = runGsdTools('config-get git.base_branch', tmpDir);
assert.strictEqual(result.success, false);
assert.ok(
result.error.includes('Key not found'),
`Expected "Key not found" in error: ${result.error}`
);
});
test('errors when no key path provided', () => {
const result = runGsdTools('config-get', tmpDir);
assert.strictEqual(result.success, false);