Files
vyndr/tests/unit/socialPreview.test.js
builtbykev b012da13f8 Session 53: Social preview fix — OG meta tags + image (2246 tests)
The link preview still showed engineer-speak ("Bayesian intelligence", "kill
conditions") because the OG meta tags were never updated after the S44 landing
cleanup.

- layout.tsx: de-jargoned the openGraph + main description + titles → "Pre-graded
  player props with proprietary archetypes. Correlation-aware Parlay Lab.
  Real-time line movement tracking. Built in Detroit." (Used "proprietary
  archetypes" not "45" — codebase has 41.)
- NEW app/opengraph-image.tsx (+ twitter-image.tsx re-export): dynamically
  generated 1200x630 card — VYNDR wordmark, "The books have every advantage. /
  We built this to give it back." + feature row. Node runtime (not edge —
  self-hosted standalone). Both routes prerender to a real PNG.
- Removed the stale /og-image.png metadata ref so the file convention owns the
  image (no duplicate og:image tag).

Backend 2239 -> 2246 tests (+7), 193 suites. Web build clean (exit 0).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 14:25:05 -04:00

51 lines
1.8 KiB
JavaScript

// Session 53 — social preview: clean OG/Twitter copy + generated OG image.
const fs = require('fs');
const path = require('path');
const APP = path.join(__dirname, '..', '..', 'web', 'src', 'app');
const read = (rel) => fs.readFileSync(path.join(APP, rel), 'utf8');
describe('Open Graph / Twitter metadata (layout)', () => {
const src = read('layout.tsx');
it('drops the engineer-speak from the social copy', () => {
const og = src.slice(src.indexOf('openGraph'));
expect(og).not.toMatch(/Bayesian/i);
expect(og).not.toMatch(/kill condition/i);
expect(og).not.toMatch(/point-biserial/i);
expect(og).not.toMatch(/xG regression/i);
});
it('uses the new user-facing copy', () => {
expect(src).toContain("The edge the books don't want you to have");
expect(src).toContain('Pre-graded player props');
expect(src).toContain('Parlay Lab');
expect(src).toContain('Built in Detroit');
});
it('keeps the large Twitter card + creator', () => {
expect(src).toContain("card: 'summary_large_image'");
expect(src).toContain("creator: '@getvyndr'");
});
it('lets the file-based convention own the image (no stale /og-image.png ref)', () => {
expect(src).not.toContain('/og-image.png');
});
});
describe('generated OG image', () => {
const og = read('opengraph-image.tsx');
it('is a 1200x630 PNG with the new tagline', () => {
expect(og).toContain('width: 1200, height: 630');
expect(og).toContain("contentType = 'image/png'");
expect(og).toContain('We built this to give it back.');
expect(og).toContain('BUILT IN DETROIT');
});
it('does NOT use the edge runtime (self-hosted standalone)', () => {
expect(og).not.toContain("runtime = 'edge'");
});
it('twitter-image reuses the same card', () => {
expect(read('twitter-image.tsx')).toContain("from './opengraph-image'");
});
});