From 0ef0f4837c1df47beac6a342d93dfa1e2a480dca Mon Sep 17 00:00:00 2001 From: KANISHKA GUPTA Date: Sun, 31 May 2026 11:10:47 +0530 Subject: [PATCH] git --- components/dashboard/GithubWrapped.test.tsx | 56 ++++++++++++++++++--- 1 file changed, 48 insertions(+), 8 deletions(-) diff --git a/components/dashboard/GithubWrapped.test.tsx b/components/dashboard/GithubWrapped.test.tsx index c75322e8..01707232 100644 --- a/components/dashboard/GithubWrapped.test.tsx +++ b/components/dashboard/GithubWrapped.test.tsx @@ -1,8 +1,13 @@ import { render, screen } from '@testing-library/react'; -import { describe, it, expect } from 'vitest'; +import { describe, it, expect, vi } from 'vitest'; import '@testing-library/jest-dom'; import GithubWrapped from './GithubWrapped'; +vi.mock('framer-motion', () => ({ + motion: { + div: ({ children }: { children: React.ReactNode }) =>
{children}
, + }, +})); import type { WrappedStats, UserProfile } from '@/types/dashboard'; @@ -34,22 +39,57 @@ const mockWrappedData: WrappedStats = { weekendRatio: 30, }; -describe('GithubWrapped Footer', () => { - it('renders Developer Score label', () => { +describe('GithubWrapped', () => { + it('renders user name', () => { + render(); + + expect(screen.getByText('Test User')).toBeInTheDocument(); + }); + + it('renders total contributions', () => { render(); - expect(screen.getByText(/Developer Score:/i)).toBeInTheDocument(); + expect(screen.getByText('1,200')).toBeInTheDocument(); }); - it('renders the numeric developer score value', () => { + it('renders top language', () => { render(); - expect(screen.getByText(/92\/100/i)).toBeInTheDocument(); + expect(screen.getByText('TypeScript')).toBeInTheDocument(); }); - it('renders COMMITPULSE branding text', () => { + it('renders highest daily count', () => { render(); - expect(screen.getByText('COMMITPULSE')).toBeInTheDocument(); + expect(screen.getByText('25 Commits')).toBeInTheDocument(); + }); + + it('renders busiest month formatted correctly', () => { + render(); + + expect(screen.getByText('April 2026')).toBeInTheDocument(); + }); + + it('renders weekend ratio percentage', () => { + render(); + + expect(screen.getByText('30%')).toBeInTheDocument(); + }); + + it('renders Take a break when weekend ratio is greater than 25', () => { + render(); + + expect(screen.getByText(/Take a break!/i)).toBeInTheDocument(); + }); + + it('renders Good work/life balance when weekend ratio is 25 or less', () => { + const balancedData = { + ...mockWrappedData, + weekendRatio: 20, + }; + + render(); + + expect(screen.getByText(/Good work\/life balance!/i)).toBeInTheDocument(); }); });