Skip to content

Commit a6c65d1

Browse files
authored
Merge pull request #29 from quran/feature/qf-6042-foundation-og-testing
[QF-6042] Host Quran Foundation Open Graph preview
2 parents 004d9ec + 0983ee0 commit a6c65d1

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

54.4 KB
Loading

‎tests/qdc-branding.spec.ts‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ const PREMADE_SHA256: Record<string, string> = {
3434

3535
const MAX_PREMADE_TOTAL_BYTES = 3_200_000;
3636
const SHARED_HOME_SHA256 = '368a4a2322286a7137cb432e8145bae75354e117900b3331b6c3ad445e6e5bac';
37+
const QURAN_FOUNDATION_SHA256 = '00eef4b441216fc1943b130b1736ddfe4a4a6f0a97e59838aa7ff87611101160';
3738
const LEGACY_HOME_LOCALES = [
3839
'ar',
3940
'bn',
@@ -96,6 +97,16 @@ test('homepage locales resolve to one centered 1200 by 630 QDC logo image', () =
9697
});
9798
});
9899

100+
test('Quran Foundation uses its approved 1200 by 630 Open Graph image', () => {
101+
const image = fs.readFileSync(
102+
path.join(process.cwd(), 'public/premade/og-quran-foundation.png'),
103+
);
104+
105+
expect(image.readUInt32BE(16), 'image width').toBe(1200);
106+
expect(image.readUInt32BE(20), 'image height').toBe(630);
107+
expect(crypto.createHash('sha256').update(image).digest('hex')).toBe(QURAN_FOUNDATION_SHA256);
108+
});
109+
99110
test('premade Open Graph images stay within their existing payload budget', () => {
100111
const totalBytes = Object.keys(PREMADE_SHA256).reduce((total, fileName) => {
101112
return total + fs.statSync(path.join(process.cwd(), 'public/premade', fileName)).size;

0 commit comments

Comments
 (0)