Skip to content

Commit 20e01ac

Browse files
committed
[red] Publish accurate launch metadata
Signed-off-by: Viwat Vchirawongkwin <viwat.v@chula.ac.th> (cherry picked from commit a17aaf9a7a93b73b13e4c61c4019203cb9444ac8)
1 parent 57c665b commit 20e01ac

1 file changed

Lines changed: 51 additions & 1 deletion

File tree

‎tools/web/src/test/site-contract.test.tsx‎

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { render, screen, within } from "@testing-library/react";
99
import { describe, expect, it } from "vitest";
1010

1111
import FlashPage, { metadata as flashMetadata } from "@/app/flash/page";
12+
import { metadata as rootMetadata } from "@/app/layout";
1213
import HomePage, { metadata as homeMetadata } from "@/app/page";
1314
import PrivacyPage, { metadata as privacyMetadata } from "@/app/privacy/page";
1415
import 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(/https?:\/\/[^<]*\.(?:png|svg|jpg)/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-
/initial beta firmware supports ESP32, ESP32-S3, and ESP32-C3/i,
489+
/public installer supports only esp32-4mb and esp32-s3-n16r8/i,
443490
),
444491
).toBeInTheDocument();
492+
expect(
493+
screen.getByText(/ESP32-C3 is not currently available/i),
494+
).toBeInTheDocument();
445495
expect(
446496
screen.getByText(
447497
/boards route LEDs, buttons, and NeoPixels differently/i,

0 commit comments

Comments
 (0)