Files
minstrel/web/src/lib/components/DiscoverTabs.test.ts
T
bvandeusenandClaude Opus 5.5 ca9917d8cd
release / govulncheck (push) Successful in 23s
release / web (push) Successful in 1m22s
release / go (push) Successful in 1m41s
release / integration (push) Successful in 4m49s
release / android (push) Successful in 5m32s
release / Build signed APK (releases and dev) (push) Successful in 5m39s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 28s
release / Verify release artifacts (tag releases only) (push) Skipped
chore(web): clear kit 3's alias and Vite's config-loader deprecations (#5021)
CI run 8789 warned on both:

- kit 3 deprecates `config.alias`. The $test-utils alias becomes a
  `#test-utils/*` subpath import, matching #lib, and its 43 import sites
  move with it.
- Vite's coming native config loader needs the extension on
  vitest.config.ts's import of vite.config.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 11:03:38 -04:00

35 lines
1.3 KiB
TypeScript

import { describe, expect, test, vi } from 'vitest';
import { render, screen } from '@testing-library/svelte';
import { pageUrlModule } from '#test-utils/mocks/appState.js';
const state = vi.hoisted(() => ({
pageUrl: new URL('http://localhost/discover')
}));
vi.mock('$app/state', () => pageUrlModule(state));
import DiscoverTabs from './DiscoverTabs.svelte';
describe('DiscoverTabs', () => {
test('Discover tab is current on /discover', () => {
state.pageUrl = new URL('http://localhost/discover');
render(DiscoverTabs);
expect(screen.getByRole('link', { name: /discover/i })).toHaveAttribute('aria-current', 'page');
expect(screen.getByRole('link', { name: /requests/i })).not.toHaveAttribute('aria-current');
});
test('Requests tab is current on /requests', () => {
state.pageUrl = new URL('http://localhost/requests');
render(DiscoverTabs);
expect(screen.getByRole('link', { name: /requests/i })).toHaveAttribute('aria-current', 'page');
expect(screen.getByRole('link', { name: /discover/i })).not.toHaveAttribute('aria-current');
});
test('renders both tabs in order', () => {
state.pageUrl = new URL('http://localhost/discover');
render(DiscoverTabs);
const labels = screen.getAllByRole('link').map((l) => l.textContent?.trim());
expect(labels).toEqual(['Discover', 'Requests']);
});
});