diff --git a/components/dashboard/StatsCard.mock-integrations.test.tsx b/components/dashboard/StatsCard.mock-integrations.test.tsx new file mode 100644 index 000000000..cbb907856 --- /dev/null +++ b/components/dashboard/StatsCard.mock-integrations.test.tsx @@ -0,0 +1,59 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ + +import { describe, it, expect, vi } from 'vitest'; +import { render, screen } from '@testing-library/react'; +import StatsCard from './StatsCard'; + +vi.mock('framer-motion', () => ({ + motion: { + div: ({ children, ...props }: any) =>
{children}
, + }, +})); + +vi.mock('lucide-react', () => ({ + Flame: (props: any) =>
, + TrendingUp: (props: any) =>
, + GitCommit: (props: any) =>
, +})); + +describe('StatsCard mock integrations', () => { + it('renders with mocked Flame icon', () => { + render(); + + expect(screen.getByTestId('icon-flame')).toBeDefined(); + }); + + it('renders with mocked TrendingUp icon', () => { + render( + + ); + + expect(screen.getByTestId('icon-trending-up')).toBeDefined(); + }); + + it('renders with mocked GitCommit icon', () => { + render(); + + expect(screen.getByTestId('icon-git-commit')).toBeDefined(); + }); + + it('falls back to Flame icon when icon is unknown', () => { + render(); + + expect(screen.getByTestId('icon-flame')).toBeDefined(); + }); + + it('renders chart bars from provided chartData', () => { + render( + + ); + + expect(screen.getByText('Chart')).toBeDefined(); + }); +}); diff --git a/components/dashboard/tooltipUtils.type-compiler.test.ts b/components/dashboard/tooltipUtils.type-compiler.test.ts new file mode 100644 index 000000000..d46aefc2c --- /dev/null +++ b/components/dashboard/tooltipUtils.type-compiler.test.ts @@ -0,0 +1,58 @@ +import { describe, expectTypeOf, it } from 'vitest'; +import type { ActivityData } from '@/types/dashboard'; + +describe('tooltipUtils type compiler tests', () => { + it('validates ActivityData structure correctly', () => { + const validData: ActivityData = { + date: '2024-01-01', + count: 5, + intensity: 2, + }; + + expectTypeOf(validData.date).toBeString(); + expectTypeOf(validData.count).toBeNumber(); + expectTypeOf(validData.intensity).toBeNumber(); + }); + + it('ensures ActivityData array typing works', () => { + const data: ActivityData[] = [ + { + date: '2024-01-01', + count: 1, + intensity: 1, + }, + ]; + + expectTypeOf(data).toBeArray(); + }); + + it('accepts optional compatible values safely', () => { + const data: ActivityData = { + date: '2024-01-02', + count: 0, + intensity: 0, + }; + + expectTypeOf(data.count).toEqualTypeOf(); + }); + it('rejects invalid property types during compilation', () => { + expectTypeOf().toBeObject(); + + const invalidCount: ActivityData = { + date: '2024-01-01', + // @ts-expect-error count must be number + count: 'five', + intensity: 2, + }; + }); + + it('rejects missing required properties', () => { + expectTypeOf().toBeObject(); + + // @ts-expect-error intensity is required + const invalidData: ActivityData = { + date: '2024-01-01', + count: 5, + }; + }); +}); diff --git a/package-lock.json b/package-lock.json index 0259b992d..f468167e7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,6 @@ "dependencies": { "@resvg/resvg-js": "^2.6.2", "@tailwindcss/postcss": "^4.2.2", - "@unrs/resolver-binding-linux-x64-gnu": "*", "@vercel/analytics": "^1.6.1", "dompurify": "^3.4.7", "framer-motion": "^12.38.0",