@@ -303,39 +303,75 @@ describe("Cloudflare Docs", () => {
303303 } ) ;
304304
305305 describe ( "head tags" , async ( ) => {
306- const request = new Request ( "http://fakehost/workers/" ) ;
307- const response = await SELF . fetch ( request ) ;
308- expect ( response . status ) . toBe ( 200 ) ;
306+ describe ( "/workers/" , async ( ) => {
307+ const request = new Request ( "http://fakehost/workers/" ) ;
308+ const response = await SELF . fetch ( request ) ;
309+ expect ( response . status ) . toBe ( 200 ) ;
309310
310- const html = await response . text ( ) ;
311- const dom = parse ( html ) ;
311+ const html = await response . text ( ) ;
312+ const dom = parse ( html ) ;
312313
313- it ( "product meta tags" , ( ) => {
314- const product = dom . querySelector ( "meta[name='pcx_product']" ) ?. attributes
315- . content ;
314+ it ( "product meta tags" , ( ) => {
315+ const product = dom . querySelector ( "meta[name='pcx_product']" )
316+ ?. attributes . content ;
316317
317- const group = dom . querySelector ( "meta[name='pcx_content_group']" )
318- ?. attributes . content ;
318+ const group = dom . querySelector ( "meta[name='pcx_content_group']" )
319+ ?. attributes . content ;
319320
320- expect ( product ) . toBe ( "Workers" ) ;
321- expect ( group ) . toBe ( "Developer platform" ) ;
322- } ) ;
321+ expect ( product ) . toBe ( "Workers" ) ;
322+ expect ( group ) . toBe ( "Developer platform" ) ;
323+ } ) ;
323324
324- it ( "index.md rel='alternate' tag" , ( ) => {
325- const markdown = dom . querySelector (
326- "link[rel='alternate'][type='text/markdown']" ,
327- ) ?. attributes . href ;
325+ it ( "index.md rel='alternate' tag" , ( ) => {
326+ const markdown = dom . querySelector (
327+ "link[rel='alternate'][type='text/markdown']" ,
328+ ) ?. attributes . href ;
328329
329- expect ( markdown ) . toBe ( "/workers/index.md" ) ;
330- } ) ;
330+ expect ( markdown ) . toBe ( "/workers/index.md" ) ;
331+ } ) ;
331332
332- it ( "og:image tag" , ( ) => {
333- const image = dom . querySelector ( "meta[property='og:image']" ) ?. attributes
334- . content ;
333+ it ( "og:image tag" , ( ) => {
334+ const image = dom . querySelector ( "meta[property='og:image']" ) ?. attributes
335+ . content ;
335336
336- expect ( image ) . toBe (
337- "https://developers.cloudflare.com/dev-products-preview.png" ,
337+ expect ( image ) . toBe (
338+ "https://developers.cloudflare.com/dev-products-preview.png" ,
339+ ) ;
340+ } ) ;
341+ } ) ;
342+
343+ describe ( "/style-guide/fixtures/markdown/" , async ( ) => {
344+ const request = new Request (
345+ "http://fakehost/style-guide/fixtures/markdown/" ,
338346 ) ;
347+ const response = await SELF . fetch ( request ) ;
348+ expect ( response . status ) . toBe ( 200 ) ;
349+
350+ const html = await response . text ( ) ;
351+ const dom = parse ( html ) ;
352+
353+ it ( "title" , ( ) => {
354+ const title = dom . querySelector ( "title" ) ?. textContent ;
355+
356+ expect ( title ) . toMatchInlineSnapshot (
357+ `"Markdown · Cloudflare Style Guide"` ,
358+ ) ;
359+ } ) ;
360+
361+ it ( "description" , ( ) => {
362+ const desc = dom . querySelector ( "meta[name='description']" ) ?. attributes
363+ . content ;
364+
365+ const og = dom . querySelector ( "meta[property='og:description']" )
366+ ?. attributes . content ;
367+
368+ expect ( desc ) . toMatchInlineSnapshot (
369+ `"The HTML generated by this file is used as a test fixture for our Markdown generation."` ,
370+ ) ;
371+ expect ( og ) . toMatchInlineSnapshot (
372+ `"The HTML generated by this file is used as a test fixture for our Markdown generation."` ,
373+ ) ;
374+ } ) ;
339375 } ) ;
340376 } ) ;
341377} ) ;
0 commit comments