Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions app/components/HeroSection.test.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -20,32 +19,32 @@ describe('HeroSection', () => {
level: 1,
});

expect(heading).toBeInTheDocument();
expect(heading).toBeDefined();
});

it("heading contains 'Elevate Your'", () => {
render(<HeroSection />);

expect(screen.getByText(/Elevate Your/i)).toBeInTheDocument();
expect(screen.getByText(/Elevate Your/i)).toBeDefined();
});

it("heading contains 'Contribution Story'", () => {
render(<HeroSection />);

expect(screen.getByText(/Contribution Story/i)).toBeInTheDocument();
expect(screen.getByText(/Contribution Story/i)).toBeDefined();
});

it('renders the descriptive paragraph', () => {
render(<HeroSection />);

const paragraph = screen.getByText(/isometric/i);

expect(paragraph).toBeInTheDocument();
expect(paragraph).toBeDefined();
});

it("paragraph mentions 'isometric'", () => {
render(<HeroSection />);

expect(screen.getByText(/isometric/i)).toHaveTextContent(/isometric/i);
expect(screen.getByText(/isometric/i).textContent).toMatch(/isometric/i);
});
});
6 changes: 5 additions & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
Expand Down
35 changes: 35 additions & 0 deletions lib/svg/generator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
Loading