feat: migrate Payload CMS to MDX and harden static infrastructure
This commit is contained in:
23
tests/image-performance.test.ts
Normal file
23
tests/image-performance.test.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
describe('Performance Standard: Image Sizes Prop', () => {
|
||||
it('should ensure the Header logo has a sizes prop to prevent Next.js warnings', () => {
|
||||
const headerPath = path.resolve(__dirname, '../components/Header.tsx');
|
||||
const headerContent = fs.readFileSync(headerPath, 'utf-8');
|
||||
|
||||
// Check if the logo image has a sizes prop
|
||||
// The logo uses src={logoSrc} and width={120} height={120}
|
||||
const hasSizesProp = /<Image[^>]*sizes=[^>]*>/g.test(headerContent);
|
||||
expect(hasSizesProp).toBe(true);
|
||||
});
|
||||
|
||||
it('should ensure the Footer logo has a sizes prop to prevent Next.js warnings', () => {
|
||||
const footerPath = path.resolve(__dirname, '../components/Footer.tsx');
|
||||
const footerContent = fs.readFileSync(footerPath, 'utf-8');
|
||||
|
||||
const hasSizesProp = /<Image[^>]*sizes=[^>]*>/g.test(footerContent);
|
||||
expect(hasSizesProp).toBe(true);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user