diff --git a/app/components/HeroSection.test.tsx b/app/components/HeroSection.test.tsx index 7d642799..cb590407 100644 --- a/app/components/HeroSection.test.tsx +++ b/app/components/HeroSection.test.tsx @@ -1,4 +1,3 @@ -import '@testing-library/jest-dom'; import { render, screen } from '@testing-library/react'; import { describe, expect, it, vi } from 'vitest'; import { HeroSection } from './HeroSection'; @@ -20,19 +19,19 @@ describe('HeroSection', () => { level: 1, }); - expect(heading).toBeInTheDocument(); + expect(heading).toBeDefined(); }); it("heading contains 'Elevate Your'", () => { render(); - expect(screen.getByText(/Elevate Your/i)).toBeInTheDocument(); + expect(screen.getByText(/Elevate Your/i)).toBeDefined(); }); it("heading contains 'Contribution Story'", () => { render(); - expect(screen.getByText(/Contribution Story/i)).toBeInTheDocument(); + expect(screen.getByText(/Contribution Story/i)).toBeDefined(); }); it('renders the descriptive paragraph', () => { @@ -40,12 +39,12 @@ describe('HeroSection', () => { const paragraph = screen.getByText(/isometric/i); - expect(paragraph).toBeInTheDocument(); + expect(paragraph).toBeDefined(); }); it("paragraph mentions 'isometric'", () => { render(); - expect(screen.getByText(/isometric/i)).toHaveTextContent(/isometric/i); + expect(screen.getByText(/isometric/i).textContent).toMatch(/isometric/i); }); }); diff --git a/eslint.config.mjs b/eslint.config.mjs index 260cec45..2dc11341 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -14,7 +14,11 @@ const eslintConfig = defineConfig([ }, }, { - files: ['**/*.test.{js,jsx,ts,tsx}', '**/__tests__/**/*.{js,jsx,ts,tsx}', 'scripts/**/*.{js,jsx,ts,tsx}'], + files: [ + '**/*.test.{js,jsx,ts,tsx}', + '**/__tests__/**/*.{js,jsx,ts,tsx}', + 'scripts/**/*.{js,jsx,ts,tsx}', + ], rules: { 'no-console': 'off', }, diff --git a/lib/svg/generator.test.ts b/lib/svg/generator.test.ts index 31a8da1d..9b4bdb9b 100644 --- a/lib/svg/generator.test.ts +++ b/lib/svg/generator.test.ts @@ -533,6 +533,41 @@ describe('generateSVG', () => { expect(svg).toContain('OCTOCAT'); }); }); + + describe('SVG dimensions per size', () => { + it('renders width="600" and height="420" for medium size (default)', () => { + const svg = generateSVG( + mockStats, + { user: 'avi', size: 'medium' } as unknown as BadgeParams, + mockCalendar + ); + + expect(svg).toContain('width="600"'); + expect(svg).toContain('height="420"'); + }); + + it('renders width="400" and height="280" for small size', () => { + const svg = generateSVG( + mockStats, + { user: 'avi', size: 'small' } as unknown as BadgeParams, + mockCalendar + ); + + expect(svg).toContain('width="400"'); + expect(svg).toContain('height="280"'); + }); + + it('renders width="800" and height="560" for large size', () => { + const svg = generateSVG( + mockStats, + { user: 'avi', size: 'large' } as unknown as BadgeParams, + mockCalendar + ); + + expect(svg).toContain('width="800"'); + expect(svg).toContain('height="560"'); + }); + }); }); describe('generateMonthlySVG', () => {