Skip to content

Commit 157da10

Browse files
committed
fix: update create-specs tests for flattened plugin structure
Fixed 8 failing tests after stackshift2 merge: Test Fixes: - Updated template copy path: templates/ → plugin/templates/ (F002 tools look for templates in plugin/templates/) - Updated assertions to match automated spec generation output - Changed expectations from guidance text to actual generation results All 446 tests now passing: - create-specs.test.ts: 20/20 passing - Full suite: 446/446 passing Build: ✅ TypeScript clean Tests: ✅ All passing
1 parent d6f8805 commit 157da10

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

mcp-server/src/tools/__tests__/create-specs.test.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ describe('Create Specs Tool Tests', () => {
3434
);
3535
await fs.writeFile(path.join(docsDir, 'functional-specification.md'), sampleSpec);
3636

37-
// Copy templates from root project to test directory
38-
const sourceTemplatesDir = path.join(process.cwd(), '..', 'plugin', 'templates');
37+
// Copy templates from mcp-server/templates to test directory
38+
// Templates are expected in {directory}/plugin/templates by create-constitution
39+
const sourceTemplatesDir = path.join(process.cwd(), 'templates');
3940
const destTemplatesDir = path.join(dir, 'plugin', 'templates');
4041
await fs.mkdir(destTemplatesDir, { recursive: true });
4142

@@ -132,7 +133,7 @@ describe('Create Specs Tool Tests', () => {
132133

133134
const result = await createSpecsToolHandler({ directory: testDir });
134135

135-
expect(result.content[0].text).toContain('Greenfield');
136+
expect(result.content[0].text).toContain('Route: Greenfield');
136137
expect(result.content[0].text).toContain('Automated Spec Generation Complete');
137138
expect(result.content[0].text).toContain('Feature Specifications');
138139
expect(result.content[0].text).toContain('Constitution');
@@ -143,7 +144,7 @@ describe('Create Specs Tool Tests', () => {
143144

144145
const result = await createSpecsToolHandler({ directory: testDir });
145146

146-
expect(result.content[0].text).toContain('Brownfield');
147+
expect(result.content[0].text).toContain('Route: Brownfield');
147148
expect(result.content[0].text).toContain('Automated Spec Generation Complete');
148149
expect(result.content[0].text).toContain('Feature Specifications');
149150
expect(result.content[0].text).toContain('Constitution');
@@ -217,6 +218,7 @@ describe('Create Specs Tool Tests', () => {
217218
expect(result.content).toHaveLength(1);
218219
expect(result.content[0].type).toBe('text');
219220
expect(result.content[0].text).toContain('# StackShift - Gear 3');
221+
expect(result.content[0].text).toContain('Shift into 4th gear: Gap Analysis');
220222
expect(result.content[0].text).toContain('stackshift_gap_analysis');
221223
});
222224

@@ -229,6 +231,8 @@ describe('Create Specs Tool Tests', () => {
229231
expect(result.content[0].text).toContain('Feature Specifications');
230232
expect(result.content[0].text).toContain('Total Features');
231233
expect(result.content[0].text).toContain('Implementation Plans');
234+
// Check for actual stats from automated generation
235+
expect(result.content[0].text).toMatch(/(Complete|Partial|Missing)/);
232236
});
233237

234238
it('should include output structure for both routes', async () => {
@@ -239,6 +243,8 @@ describe('Create Specs Tool Tests', () => {
239243

240244
const result = await createSpecsToolHandler({ directory: testDir });
241245

246+
// Check for output structure section
247+
expect(result.content[0].text).toContain('Output Structure');
242248
expect(result.content[0].text).toContain('specs/');
243249
expect(result.content[0].text).toContain('.specify/');
244250
expect(result.content[0].text).toContain('memory/');
@@ -258,7 +264,9 @@ describe('Create Specs Tool Tests', () => {
258264
// Greenfield
259265
await stateManager.initialize(testDir, 'greenfield');
260266
let result = await createSpecsToolHandler({ directory: testDir });
267+
expect(result.content[0].text).toContain('Validate Specifications');
261268
expect(result.content[0].text).toContain('/speckit.analyze');
269+
expect(result.content[0].text).toContain('Ready for Gear 4');
262270
expect(result.content[0].text).toContain('stackshift_gap_analysis');
263271

264272
// Brownfield
@@ -271,7 +279,9 @@ describe('Create Specs Tool Tests', () => {
271279

272280
await stateManager.initialize(testDir, 'brownfield');
273281
result = await createSpecsToolHandler({ directory: testDir });
282+
expect(result.content[0].text).toContain('Validate Specifications');
274283
expect(result.content[0].text).toContain('/speckit.analyze');
284+
expect(result.content[0].text).toContain('Ready for Gear 4');
275285
expect(result.content[0].text).toContain('stackshift_gap_analysis');
276286
});
277287
});
@@ -305,7 +315,7 @@ describe('Create Specs Tool Tests', () => {
305315

306316
const result = await createSpecsToolHandler({ directory: testDir });
307317

308-
expect(result.content[0].text).toContain('4th gear: Gap Analysis');
318+
expect(result.content[0].text).toContain('Shift into 4th gear: Gap Analysis');
309319
expect(result.content[0].text).toContain('stackshift_gap_analysis');
310320
expect(result.content[0].text).toContain('/speckit.analyze');
311321
});

0 commit comments

Comments
 (0)