diff --git a/scripts/lib/production-smoke.ts b/scripts/lib/production-smoke.ts index 8fc1a850..94c13d19 100644 --- a/scripts/lib/production-smoke.ts +++ b/scripts/lib/production-smoke.ts @@ -97,6 +97,13 @@ export const PRODUCTION_SMOKE_EXPECTATIONS: SmokeExpectation[] = [ { path: '/', status: 200, bodyContains: [''], + }, { path: '/community', status: 200, bodyContains: [' { + it.each([ + [500, '

Server error

', 'status_mismatch'], + [200, '

Skill unavailable

', 'content_missing'], + [200, '', 'content_missing'], + ])('rejects a broken Skill page with status %s', async (status, body, reason) => { + const path = '/gh/anthropics/skills/skill-creator' + const result = await runProductionSmoke({ + baseUrl: 'https://skilld.dev', + attempts: 1, + wait: async () => {}, + fetch: async (input) => { + const url = new URL(input) + if (url.pathname === path) + return new Response(body, { status }) + const expectation = PRODUCTION_SMOKE_EXPECTATIONS.find(item => item.path === `${url.pathname}${url.search}`) + const content = expectation?.bodyContains?.join('') ?? '' + return new Response(`${content}${url.pathname === ASSET_COHERENCE_PATH ? '' : ''}`, { + status: expectation?.status ?? 200, + headers: { 'content-type': 'text/html', ...(expectation?.location ? { location: expectation.location } : {}) }, + }) + }, + }) + expect(result).toEqual({ + _tag: 'failed', + failures: [expect.objectContaining({ path, result: expect.objectContaining({ reason }) })], + }) + }) + it('covers the public routes implicated by the closed incidents', () => { expect(PRODUCTION_SMOKE_EXPECTATIONS).toEqual(expect.arrayContaining([ // The homepage asserts its own hero words, because the page's error