Skip to content
Merged
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
15 changes: 11 additions & 4 deletions app/(root)/dashboard/error.empty-fallback.test.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// app/(root)/dashboard/error.empty-fallback.test.tsx

import { describe, expect, it, vi } from 'vitest';
import { render, screen } from '@testing-library/react';
import '@testing-library/jest-dom/vitest';
import { render, screen } from '@testing-library/react';
import { describe, it, expect, vi } from 'vitest';
import DashboardError from './error';

vi.mock('next/link', () => ({
default: ({
Expand All @@ -13,8 +14,6 @@ vi.mock('next/link', () => ({
),
}));

import DashboardError from './error';

describe('Dashboard Error Page - Empty & Missing Input Fallbacks', () => {
it('renders successfully when error is null', () => {
expect(() =>
Expand Down Expand Up @@ -70,6 +69,14 @@ describe('Dashboard Error Page - Empty & Missing Input Fallbacks', () => {
).toBeInTheDocument();
});

it('renders without errors when the optional digest field is absent', () => {
const error = new Error('Unexpected failure') as Error & { digest?: string };

expect(() => render(<DashboardError error={error} reset={vi.fn()} />)).not.toThrow();

expect(screen.getByText('⚠️')).toBeInTheDocument();
});

it('renders interactive elements correctly in fallback state', () => {
render(<DashboardError error={{} as unknown as Error} reset={vi.fn()} />);

Expand Down
Loading