mirror of
https://github.com/garrytan/gstack.git
synced 2026-08-07 14:58:37 +02:00
fix(test): align gstack-config tests with defaults-fallback behavior
Three tests (last touched v0.13.7.0) asserted get/list print empty for unset keys, but gstack-config falls back to the documented defaults table (get returns the default, list shows the active-values block). Update the assertions to the real behavior and split out an unknown-key case that does still return empty. Pre-existing red, unrelated to codex review. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
b16f55128e
commit
dd5cf5b25c
@@ -41,9 +41,16 @@ afterEach(() => {
|
|||||||
|
|
||||||
describe('gstack-config', () => {
|
describe('gstack-config', () => {
|
||||||
// ─── get ──────────────────────────────────────────────────
|
// ─── get ──────────────────────────────────────────────────
|
||||||
test('get on missing file returns empty, exit 0', () => {
|
test('get on missing file returns the default, exit 0', () => {
|
||||||
|
// auto_upgrade has a default of false; get falls back to the defaults table.
|
||||||
const { exitCode, stdout } = run(['get', 'auto_upgrade']);
|
const { exitCode, stdout } = run(['get', 'auto_upgrade']);
|
||||||
expect(exitCode).toBe(0);
|
expect(exitCode).toBe(0);
|
||||||
|
expect(stdout).toBe('false');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('get unknown key on missing file returns empty, exit 0', () => {
|
||||||
|
const { exitCode, stdout } = run(['get', 'some_unknown_key']);
|
||||||
|
expect(exitCode).toBe(0);
|
||||||
expect(stdout).toBe('');
|
expect(stdout).toBe('');
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -110,10 +117,12 @@ describe('gstack-config', () => {
|
|||||||
expect(stdout).toContain('update_check: false');
|
expect(stdout).toContain('update_check: false');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('list on missing file returns empty, exit 0', () => {
|
test('list on missing file shows defaults, exit 0', () => {
|
||||||
|
// list prints the active-values block with defaults for unset keys.
|
||||||
const { exitCode, stdout } = run(['list']);
|
const { exitCode, stdout } = run(['list']);
|
||||||
expect(exitCode).toBe(0);
|
expect(exitCode).toBe(0);
|
||||||
expect(stdout).toBe('');
|
expect(stdout).toContain('proactive:');
|
||||||
|
expect(stdout).toContain('(default)');
|
||||||
});
|
});
|
||||||
|
|
||||||
// ─── usage ────────────────────────────────────────────────
|
// ─── usage ────────────────────────────────────────────────
|
||||||
@@ -199,9 +208,9 @@ describe('gstack-config', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// ─── routing_declined ──────────────────────────────────────
|
// ─── routing_declined ──────────────────────────────────────
|
||||||
test('routing_declined defaults to empty (not set)', () => {
|
test('routing_declined defaults to false (not set)', () => {
|
||||||
const { stdout } = run(['get', 'routing_declined']);
|
const { stdout } = run(['get', 'routing_declined']);
|
||||||
expect(stdout).toBe('');
|
expect(stdout).toBe('false');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('routing_declined can be set and read', () => {
|
test('routing_declined can be set and read', () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user