@@ -9,6 +9,7 @@ import { render, screen, within } from "@testing-library/react";
99import { describe , expect , it } from "vitest" ;
1010
1111import FlashPage , { metadata as flashMetadata } from "@/app/flash/page" ;
12+ import { metadata as rootMetadata } from "@/app/layout" ;
1213import HomePage , { metadata as homeMetadata } from "@/app/page" ;
1314import PrivacyPage , { metadata as privacyMetadata } from "@/app/privacy/page" ;
1415import SupportPage , { metadata as supportMetadata } from "@/app/support/page" ;
@@ -75,6 +76,52 @@ describe("public-site contract", () => {
7576 } ) ;
7677 } ) ;
7778
79+ it ( "publishes a real-app large social card and local TestFlight card" , async ( ) => {
80+ const socialUrl =
81+ "https://pyble.dev/social/pyble-beta-og-1200x630.png" ;
82+ expect ( rootMetadata . openGraph ?. images ) . toEqual ( [
83+ {
84+ url : socialUrl ,
85+ width : 1200 ,
86+ height : 630 ,
87+ alt : "Actual PyBLE iPad app showing GPIO 48 NeoPixel Blocks and generated MicroPython code" ,
88+ } ,
89+ ] ) ;
90+ expect ( rootMetadata . twitter ) . toMatchObject ( {
91+ card : "summary_large_image" ,
92+ images : [ socialUrl ] ,
93+ } ) ;
94+ expect ( supportMetadata . openGraph ?. images ) . toEqual (
95+ rootMetadata . openGraph ?. images ,
96+ ) ;
97+ expect ( supportMetadata . twitter ) . toMatchObject ( {
98+ card : "summary_large_image" ,
99+ images : [ socialUrl ] ,
100+ } ) ;
101+
102+ const publicDirectory = join ( process . cwd ( ) , "public" ) ;
103+ const [ socialPng , qrCardPng , qrCardSvg ] = await Promise . all ( [
104+ readFile ( join ( publicDirectory , "social" , "pyble-beta-og-1200x630.png" ) ) ,
105+ readFile (
106+ join ( publicDirectory , "social" , "pyble-testflight-qr-1080.png" ) ,
107+ ) ,
108+ readFile (
109+ join ( publicDirectory , "social" , "pyble-testflight-qr-1080.svg" ) ,
110+ "utf8" ,
111+ ) ,
112+ ] ) ;
113+ expect ( [
114+ socialPng . readUInt32BE ( 16 ) ,
115+ socialPng . readUInt32BE ( 20 ) ,
116+ ] ) . toEqual ( [ 1200 , 630 ] ) ;
117+ expect ( [
118+ qrCardPng . readUInt32BE ( 16 ) ,
119+ qrCardPng . readUInt32BE ( 20 ) ,
120+ ] ) . toEqual ( [ 1080 , 1080 ] ) ;
121+ expect ( qrCardSvg ) . toContain ( "testflight.apple.com/join/yU4e8s6d" ) ;
122+ expect ( qrCardSvg ) . not . toMatch ( / h t t p s ? : \/ \/ [ ^ < ] * \. (?: p n g | s v g | j p g ) / i) ;
123+ } ) ;
124+
78125 it ( "exposes accessible primary navigation" , ( ) => {
79126 render ( < SiteHeader /> ) ;
80127
@@ -439,9 +486,12 @@ describe("public-site contract", () => {
439486 expect ( screen . getByText ( "Board and chip family" ) ) . toBeInTheDocument ( ) ;
440487 expect (
441488 screen . getByText (
442- / i n i t i a l b e t a f i r m w a r e s u p p o r t s E S P 3 2 , E S P 3 2 - S 3 , a n d E S P 3 2 - C 3 / i,
489+ / p u b l i c i n s t a l l e r s u p p o r t s o n l y e s p 3 2 - 4 m b a n d e s p 3 2 - s 3 - n 1 6 r 8 / i,
443490 ) ,
444491 ) . toBeInTheDocument ( ) ;
492+ expect (
493+ screen . getByText ( / E S P 3 2 - C 3 i s n o t c u r r e n t l y a v a i l a b l e / i) ,
494+ ) . toBeInTheDocument ( ) ;
445495 expect (
446496 screen . getByText (
447497 / b o a r d s r o u t e L E D s , b u t t o n s , a n d N e o P i x e l s d i f f e r e n t l y / i,
0 commit comments