Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

1.4 KB
Raw Blame
/** Notification removal remains idempotent across manual and timed dismissal. */

import '@js/config/urls.js';

it('does not remove the same notification twice after manual close', async () => {
    vi.useFakeTimers();
    vi.stubGlobal('Notification', { permission: 'denied' });

    try {
        await import('@js/components/progress.js');
        window.showNotification(
            'Migration complete',
            'This notification can be dismissed immediately.',
            'info',
            1000,
        );

        const notification = document.querySelector(
            '#notification-container .ldr-alert',
        );
        expect(notification).not.toBeNull();
        notification.querySelector('.btn-close').click();

        await vi.advanceTimersByTimeAsync(300);
        expect(document.querySelector('#notification-container .ldr-alert'))
            .toBeNull();

        // The independent expiry timer still fires later. It must recognize
        // that manual dismissal already detached this exact element.
        await vi.advanceTimersByTimeAsync(1000);
        expect(document.querySelector('#notification-container .ldr-alert'))
            .toBeNull();
    } finally {
        vi.clearAllTimers();
        vi.useRealTimers();
        vi.restoreAllMocks();
        vi.unstubAllGlobals();
        delete window.progressComponent;
        delete window.showNotification;
        document.body.replaceChildren();
    }
});