Files
get-shit-done/tests/bug-1962-phase-suffix-case.test.cjs
Tibsfox cb1eb7745a fix(core): preserve letter suffix case in normalizePhaseName (#1963)
* fix(core): preserve letter suffix case in normalizePhaseName (#1962)

normalizePhaseName uppercased letter suffixes (e.g., "16c" → "16C"),
causing directory/roadmap mismatches on case-sensitive filesystems.
init progress couldn't match directory "16C-name" to roadmap "16c".

Preserve original case — comparePhaseNum still uppercases for sorting
(correct), but normalizePhaseName is used for display and directory
creation where case must match the roadmap.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* test(phase): update existing test to expect preserved letter case

The 'uppercases letters' test asserted the old behavior (3a → 03A).
With normalizePhaseName now preserving case, update expectations to
match (3a → 03a) and rename the test to 'preserves letter case'.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 10:48:00 -04:00

50 lines
1.5 KiB
JavaScript

/**
* Regression tests for bug #1962
*
* normalizePhaseName must preserve the original case of letter suffixes.
* Uppercasing "16c" to "16C" causes directory/roadmap mismatches on
* case-sensitive filesystems — init progress can't match the directory
* back to the roadmap phase entry.
*/
'use strict';
const { describe, test } = require('node:test');
const assert = require('node:assert/strict');
const { normalizePhaseName } = require('../get-shit-done/bin/lib/core.cjs');
describe('bug #1962: normalizePhaseName preserves letter suffix case', () => {
test('lowercase suffix preserved: 16c → 16c', () => {
assert.equal(normalizePhaseName('16c'), '16c');
});
test('uppercase suffix preserved: 16C → 16C', () => {
assert.equal(normalizePhaseName('16C'), '16C');
});
test('single digit padded with lowercase suffix: 1a → 01a', () => {
assert.equal(normalizePhaseName('1a'), '01a');
});
test('single digit padded with uppercase suffix: 1A → 01A', () => {
assert.equal(normalizePhaseName('1A'), '01A');
});
test('no suffix unchanged: 16 → 16', () => {
assert.equal(normalizePhaseName('16'), '16');
});
test('decimal suffix preserved: 16.1 → 16.1', () => {
assert.equal(normalizePhaseName('16.1'), '16.1');
});
test('letter + decimal preserved: 16c.2 → 16c.2', () => {
assert.equal(normalizePhaseName('16c.2'), '16c.2');
});
test('project code prefix stripped, suffix case preserved: CK-01a → 01a', () => {
assert.equal(normalizePhaseName('CK-01a'), '01a');
});
});