24 lines
966 B
TypeScript
24 lines
966 B
TypeScript
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);
|
|
});
|
|
});
|