File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 11import { test , expect } from "@playwright/test" ;
2+ import type { BinaryLike } from "node:crypto" ;
3+ import { createHash } from "node:crypto" ;
4+
5+ const OG_MD5 = "2f7b724d62d8c7739076da211aa62e7b" ;
6+
7+ export function validateMd5 ( data : Buffer , expectedHash : string ) {
8+ return (
9+ createHash ( "md5" )
10+ . update ( data as BinaryLike )
11+ . digest ( "hex" ) === expectedHash
12+ ) ;
13+ }
214
315test ( "the application's noop index page is visible and it allows navigating to the hello-world api route" , async ( {
416 page,
@@ -47,4 +59,5 @@ test("generates an og image successfully", async ({ page }) => {
4759 const res = await page . request . get ( "/og" ) ;
4860 expect ( res . status ( ) ) . toEqual ( 200 ) ;
4961 expect ( res . headers ( ) [ "content-type" ] ) . toEqual ( "image/png" ) ;
62+ expect ( validateMd5 ( await res . body ( ) , OG_MD5 ) ) . toEqual ( true ) ;
5063} ) ;
You can’t perform that action at this time.
0 commit comments