@@ -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 ( / ( C o m p l e t e | P a r t i a l | M i s s i n g ) / ) ;
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