@@ -8,6 +8,34 @@ import {
88} from '../../scripts/lib/production-smoke'
99
1010describe ( 'production smoke contract' , ( ) => {
11+ it . each ( [
12+ [ 500 , '<h1>Server error</h1>' , 'status_mismatch' ] ,
13+ [ 200 , '<h1>Skill unavailable</h1>' , 'content_missing' ] ,
14+ [ 200 , '<script>{"name":"skill-creator"}</script>' , 'content_missing' ] ,
15+ ] ) ( 'rejects a broken Skill page with status %s' , async ( status , body , reason ) => {
16+ const path = '/gh/anthropics/skills/skill-creator'
17+ const result = await runProductionSmoke ( {
18+ baseUrl : 'https://skilld.dev' ,
19+ attempts : 1 ,
20+ wait : async ( ) => { } ,
21+ fetch : async ( input ) => {
22+ const url = new URL ( input )
23+ if ( url . pathname === path )
24+ return new Response ( body , { status } )
25+ const expectation = PRODUCTION_SMOKE_EXPECTATIONS . find ( item => item . path === `${ url . pathname } ${ url . search } ` )
26+ const content = expectation ?. bodyContains ?. join ( '' ) ?? ''
27+ return new Response ( `${ content } ${ url . pathname === ASSET_COHERENCE_PATH ? '<script src="/_nuxt/v2/app.js"></script>' : '' } ` , {
28+ status : expectation ?. status ?? 200 ,
29+ headers : { 'content-type' : 'text/html' , ...( expectation ?. location ? { location : expectation . location } : { } ) } ,
30+ } )
31+ } ,
32+ } )
33+ expect ( result ) . toEqual ( {
34+ _tag : 'failed' ,
35+ failures : [ expect . objectContaining ( { path, result : expect . objectContaining ( { reason } ) } ) ] ,
36+ } )
37+ } )
38+
1139 it ( 'covers the public routes implicated by the closed incidents' , ( ) => {
1240 expect ( PRODUCTION_SMOKE_EXPECTATIONS ) . toEqual ( expect . arrayContaining ( [
1341 // The homepage asserts its own hero words, because the page's error
0 commit comments