@@ -29,6 +29,15 @@ type TaxonomyFeatureFixture = {
2929 coverageIds ?: string [ ] ;
3030} ;
3131
32+ type MaturityScoresFixture = {
33+ rollups ?: {
34+ surface_average ?: {
35+ quality ?: { score ?: number } ;
36+ completeness ?: { score ?: number } ;
37+ } ;
38+ } ;
39+ } ;
40+
3241afterEach ( ( ) => {
3342 tempDirs . cleanup ( ) ;
3443} ) ;
@@ -170,6 +179,23 @@ function allProfileScorecardFixture() {
170179 } ;
171180}
172181
182+ function expectedMaturityScorePercent ( ) : number {
183+ const scores = parseYaml (
184+ fs . readFileSync ( path . join ( repoRoot , "qa/maturity-scores.yaml" ) , "utf8" ) ,
185+ ) as MaturityScoresFixture ;
186+ const quality = scores . rollups ?. surface_average ?. quality ?. score ;
187+ const completeness = scores . rollups ?. surface_average ?. completeness ?. score ;
188+ if (
189+ typeof quality !== "number" ||
190+ ! Number . isFinite ( quality ) ||
191+ typeof completeness !== "number" ||
192+ ! Number . isFinite ( completeness )
193+ ) {
194+ throw new Error ( "maturity score fixture is missing surface rollup scores" ) ;
195+ }
196+ return Math . round ( ( quality + completeness ) / 2 ) ;
197+ }
198+
173199describe ( "maturity docs renderer CLI" , ( ) => {
174200 it ( "checks maturity inputs without requiring QA evidence artifacts" , ( ) => {
175201 const result = runCli ( "--check" ) ;
@@ -246,7 +272,9 @@ describe("maturity docs renderer CLI", () => {
246272 expect ( result . status ) . toBe ( 0 ) ;
247273 const scorecard = fs . readFileSync ( path . join ( outputDir , "maturity" , "scorecard.md" ) , "utf8" ) ;
248274 expect ( scorecard ) . toContain ( "<span>Maturity score</span>" ) ;
249- expect ( scorecard ) . toContain ( '<span className="maturity-summary-value">67%</span>' ) ;
275+ expect ( scorecard ) . toContain (
276+ `<span className="maturity-summary-value">${ expectedMaturityScorePercent ( ) } %</span>` ,
277+ ) ;
250278 expect ( scorecard ) . toContain ( "Coverage Experimental - 0%" ) ;
251279 expect ( scorecard ) . toContain ( "end-to-end coverage above 90%" ) ;
252280 } ) ;
0 commit comments