ci: expand CI checks and make consumer sync opt-in
- Add Go, npm, Python, and Java validation to CI - Run Go tests against PostgreSQL - Record performance fixes in the report
This commit is contained in:
1 parent
199a5efaef
commit
22887fef03
100 files changed
+9740
-429
No files matched your search
@@ -0,0 +1,38 @@
|
||||
import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/svelte';
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest';
|
||||
import NotificationStack from '../src/lib/components/NotificationStack.svelte';
|
||||
import { notifications, notify } from '../src/lib/notifications.svelte';
|
||||
|
||||
// The icon library compiles over a thousand components on import; the icons are not under test.
|
||||
vi.mock('@lucide/svelte', () => {
|
||||
const Icon = (): void => {};
|
||||
return { CircleAlert: Icon, CircleCheck: Icon, Info: Icon, OctagonAlert: Icon, X: Icon };
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
cleanup();
|
||||
for (const entry of [...notifications.entries]) notifications.dismiss(entry.id);
|
||||
});
|
||||
|
||||
describe('NotificationStack', () => {
|
||||
it('renders each notification with its variant and message', async () => {
|
||||
render(NotificationStack);
|
||||
notify.success('Saved', 0);
|
||||
notify.error('Failed', 0);
|
||||
await waitFor(() => expect(screen.getByText('Saved')).toBeTruthy());
|
||||
expect(screen.getByText('Failed')).toBeTruthy();
|
||||
const variants = [...document.querySelectorAll('.sc-notification')].map((node) =>
|
||||
node.getAttribute('data-variant'),
|
||||
);
|
||||
expect(variants).toEqual(['success', 'error']);
|
||||
expect(screen.getByRole('status').getAttribute('aria-live')).toBe('polite');
|
||||
});
|
||||
|
||||
it('dismisses a notification from its close button', async () => {
|
||||
render(NotificationStack);
|
||||
notify.info('Dismiss me', 0);
|
||||
await waitFor(() => expect(screen.getByText('Dismiss me')).toBeTruthy());
|
||||
await fireEvent.click(screen.getByLabelText('Dismiss notification'));
|
||||
expect(notifications.entries).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user