Skip to content

Commit b0697c9

Browse files
test(site): align OG title font-size tests with the 1200x630 card thresholds
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent dc64f5e commit b0697c9

2 files changed

Lines changed: 18 additions & 16 deletions

File tree

‎apps/site/tests/tier1-features.test.mjs‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -733,13 +733,15 @@ describe("Tier 1 - Feature Coverage", () => {
733733
assert.equal(ogUtils.TYPE_COLORS.Author, "#ec4899");
734734
});
735735

736-
it("5.3 titleFontSize dynamically scales for lengths: <=40 (56), 41-60 (48), >60 (42)", () => {
736+
it("5.3 titleFontSize dynamically scales for lengths: <=30 (56), 31-50 (50), 51-70 (44), >70 (38)", () => {
737737
assert.equal(ogUtils.titleFontSize("Short Title"), 56);
738-
assert.equal(ogUtils.titleFontSize("A".repeat(40)), 56);
739-
assert.equal(ogUtils.titleFontSize("A".repeat(41)), 48);
740-
assert.equal(ogUtils.titleFontSize("A".repeat(60)), 48);
741-
assert.equal(ogUtils.titleFontSize("A".repeat(61)), 42);
742-
assert.equal(ogUtils.titleFontSize("A".repeat(120)), 42);
738+
assert.equal(ogUtils.titleFontSize("A".repeat(30)), 56);
739+
assert.equal(ogUtils.titleFontSize("A".repeat(31)), 50);
740+
assert.equal(ogUtils.titleFontSize("A".repeat(50)), 50);
741+
assert.equal(ogUtils.titleFontSize("A".repeat(51)), 44);
742+
assert.equal(ogUtils.titleFontSize("A".repeat(70)), 44);
743+
assert.equal(ogUtils.titleFontSize("A".repeat(71)), 38);
744+
assert.equal(ogUtils.titleFontSize("A".repeat(120)), 38);
743745
});
744746

745747
it("5.4 All 4 OG image endpoints exist and export GET handler with parameter parsing", () => {

‎apps/site/tests/tier3-combinations.test.mjs‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -219,28 +219,28 @@ describe("Tier 3 - Cross-Feature Combinations", () => {
219219
describe("Dynamic OG Fallback Scaling & Long Titles", () => {
220220
const ogUtils = loadModule("src/lib/og-utils.ts");
221221

222-
it("3.1 Short title (<= 40 chars) receives 56px font size", () => {
222+
it("3.1 Short title (<= 30 chars) receives 56px font size", () => {
223223
const title = "Astro vs Next.js";
224-
assert.equal(title.length < 40, true);
224+
assert.ok(title.length <= 30);
225225
assert.equal(ogUtils.titleFontSize(title), 56);
226226
});
227227

228-
it("3.2 Medium title (41-60 chars) receives 48px font size", () => {
228+
it("3.2 Medium-long title (51-70 chars) receives 44px font size", () => {
229229
const title = "Complete Guide to Cloudflare Workers with Astro SSR";
230-
assert.ok(title.length >= 41 && title.length <= 60);
231-
assert.equal(ogUtils.titleFontSize(title), 48);
230+
assert.ok(title.length >= 51 && title.length <= 70);
231+
assert.equal(ogUtils.titleFontSize(title), 44);
232232
});
233233

234-
it("3.3 Long title (> 60 chars) receives 42px font size", () => {
234+
it("3.3 Long title (> 70 chars) receives 38px font size", () => {
235235
const title =
236236
"Why We Are Absolutely Obsessed With Sticker Mule's Holographic Stickers";
237-
assert.ok(title.length > 60);
238-
assert.equal(ogUtils.titleFontSize(title), 42);
237+
assert.ok(title.length > 70);
238+
assert.equal(ogUtils.titleFontSize(title), 38);
239239
});
240240

241-
it("3.4 Extreme long title (> 120 chars) remains stable at 42px", () => {
241+
it("3.4 Extreme long title (> 120 chars) remains stable at 38px", () => {
242242
const title = "A".repeat(150);
243-
assert.equal(ogUtils.titleFontSize(title), 42);
243+
assert.equal(ogUtils.titleFontSize(title), 38);
244244
});
245245

246246
it("3.5 fallbackOgImage safely generates OG image URL with query params and stega cleaning", () => {

0 commit comments

Comments
 (0)