diff --git a/frontend/src/__tests__/contexts/ToastContext.test.tsx b/frontend/src/__tests__/contexts/ToastContext.test.tsx index ddd4e82fc..aa1743643 100644 --- a/frontend/src/__tests__/contexts/ToastContext.test.tsx +++ b/frontend/src/__tests__/contexts/ToastContext.test.tsx @@ -12,7 +12,7 @@ * paths no-op instead of crashing. */ -import { describe, it, expect, beforeEach, vi } from 'vitest'; +import { describe, it, expect, afterEach, beforeEach, vi } from 'vitest'; import { act, render, renderHook } from '@testing-library/react'; import { type ReactNode } from 'react'; import { ToastProvider, useToast } from '../../contexts/ToastContext'; @@ -163,3 +163,64 @@ describe('ToastContext viewport suppression', () => { expect(toast?.style.maxWidth).toContain('safe-area-inset-right'); }); }); + +describe('ToastContext auto-dismiss timing by type', () => { + // Errors and warnings carry more text than a success confirmation — a + // backend failure reason often runs to a couple of lines — so they hold + // for 6s while success/info keep the 3s default. + function TypedToastProbe({ type }: { type: 'success' | 'error' | 'warning' | 'info' }) { + const { showToast } = useToast(); + return