diff --git a/web/src/components/LidarrButton.test.tsx b/web/src/components/LidarrButton.test.tsx index 38416dd..c21f6e2 100644 --- a/web/src/components/LidarrButton.test.tsx +++ b/web/src/components/LidarrButton.test.tsx @@ -36,11 +36,11 @@ function admin(routes: MockRoutes) { beforeEach(async () => { vi.spyOn(navigator, 'language', 'get').mockReturnValue('en-US') await initI18n() - sessionStore.setState({ status: 'authenticated', user: { id: 1, username: 'tom', is_admin: true } }) + sessionStore.setState({ status: 'authenticated', user: { id: 1, email: 'tom@example.org', is_admin: true } }) }) test('a user who is not an admin sees nothing and nothing is asked', async () => { - sessionStore.setState({ user: { id: 2, username: 'ann', is_admin: false } }) + sessionStore.setState({ user: { id: 2, email: 'ann@example.org', is_admin: false } }) const { calls } = admin({}) const view = renderButton() await new Promise((r) => setTimeout(r, 50)) diff --git a/web/src/components/layout/Shell.test.tsx b/web/src/components/layout/Shell.test.tsx index 700674f..6f19e0b 100644 --- a/web/src/components/layout/Shell.test.tsx +++ b/web/src/components/layout/Shell.test.tsx @@ -40,13 +40,13 @@ const adminRoutes = { } test('an admin has an Admin link, and a user who is not one has none', () => { - sessionStore.setState({ status: 'authenticated', user: { id: 1, username: 'tom', is_admin: false } }) + sessionStore.setState({ status: 'authenticated', user: { id: 1, email: 'tom@example.org', is_admin: false } }) renderAt('/artists') expect(within(mainNav()).queryByRole('link', { name: 'Admin' })).not.toBeInTheDocument() }) test('the Admin link opens the libraries and stays current inside the admin area', async () => { - sessionStore.setState({ status: 'authenticated', user: { id: 1, username: 'tom', is_admin: true } }) + sessionStore.setState({ status: 'authenticated', user: { id: 1, email: 'tom@example.org', is_admin: true } }) mockFetch(adminRoutes) renderAt('/admin') expect(await screen.findByRole('region', { name: 'Libraries' })).toBeInTheDocument() @@ -54,7 +54,7 @@ test('the Admin link opens the libraries and stays current inside the admin area }) test('someone who is not an admin who opens the admin address gets a notice and no request', async () => { - sessionStore.setState({ status: 'authenticated', user: { id: 2, username: 'ann', is_admin: false } }) + sessionStore.setState({ status: 'authenticated', user: { id: 2, email: 'ann@example.org', is_admin: false } }) const { calls } = mockFetch(adminRoutes) renderAt('/admin/libraries') expect(screen.getByText('Only admins can see this page.')).toBeInTheDocument() diff --git a/web/src/pages/DiscoverPage.test.tsx b/web/src/pages/DiscoverPage.test.tsx index e2688b9..f9e3555 100644 --- a/web/src/pages/DiscoverPage.test.tsx +++ b/web/src/pages/DiscoverPage.test.tsx @@ -44,7 +44,7 @@ const tab = (name: string) => screen.getByRole('tab', { name }) beforeEach(async () => { vi.spyOn(navigator, 'language', 'get').mockReturnValue('en-US') await initI18n() - sessionStore.setState({ status: 'authenticated', user: { id: 1, username: 'tom', is_admin: false } }) + sessionStore.setState({ status: 'authenticated', user: { id: 1, email: 'tom@example.org', is_admin: false } }) }) test('it opens on the suggestions', async () => { diff --git a/web/src/pages/admin/AddLibraryForm.test.tsx b/web/src/pages/admin/AddLibraryForm.test.tsx index 9b63f02..cd583d0 100644 --- a/web/src/pages/admin/AddLibraryForm.test.tsx +++ b/web/src/pages/admin/AddLibraryForm.test.tsx @@ -29,7 +29,7 @@ const add = () => screen.getByRole('button', { name: 'Add library' }) beforeEach(async () => { vi.spyOn(navigator, 'language', 'get').mockReturnValue('en-US') await initI18n() - sessionStore.setState({ status: 'authenticated', user: { id: 1, username: 'tom', is_admin: true } }) + sessionStore.setState({ status: 'authenticated', user: { id: 1, email: 'tom@example.org', is_admin: true } }) }) test('it says the folder is on the machine that runs Sonda, not on this computer', () => { diff --git a/web/src/pages/admin/AdminLayout.test.tsx b/web/src/pages/admin/AdminLayout.test.tsx index abdce8e..6c190f8 100644 --- a/web/src/pages/admin/AdminLayout.test.tsx +++ b/web/src/pages/admin/AdminLayout.test.tsx @@ -24,7 +24,7 @@ beforeEach(async () => { }) test('an admin gets the admin page with its sections and the page of the section', () => { - sessionStore.setState({ status: 'authenticated', user: { id: 1, username: 'tom', is_admin: true } }) + sessionStore.setState({ status: 'authenticated', user: { id: 1, email: 'tom@example.org', is_admin: true } }) renderAdmin() expect(screen.getByRole('heading', { level: 1, name: 'Admin' })).toBeInTheDocument() expect(screen.getByRole('navigation', { name: 'Admin sections' })).toBeInTheDocument() @@ -33,7 +33,7 @@ test('an admin gets the admin page with its sections and the page of the section }) test('anyone else sees a notice, not the section, and nothing is asked of the server', async () => { - sessionStore.setState({ status: 'authenticated', user: { id: 2, username: 'ann', is_admin: false } }) + sessionStore.setState({ status: 'authenticated', user: { id: 2, email: 'ann@example.org', is_admin: false } }) const { calls } = mockFetch({}) renderAdmin() expect(screen.getByText('Only admins can see this page.')).toBeInTheDocument() diff --git a/web/src/pages/admin/LibraryList.test.tsx b/web/src/pages/admin/LibraryList.test.tsx index 0a9dd8a..cd24a51 100644 --- a/web/src/pages/admin/LibraryList.test.tsx +++ b/web/src/pages/admin/LibraryList.test.tsx @@ -34,7 +34,7 @@ const bodies = (calls: RecordedCall[], key: string) => calls.filter((c) => c.key beforeEach(async () => { vi.spyOn(navigator, 'language', 'get').mockReturnValue('en-US') await initI18n() - sessionStore.setState({ status: 'authenticated', user: { id: 1, username: 'tom', is_admin: true } }) + sessionStore.setState({ status: 'authenticated', user: { id: 1, email: 'tom@example.org', is_admin: true } }) }) test('each library shows its name and its folder on the server', async () => { diff --git a/web/src/pages/admin/ScanPanel.test.tsx b/web/src/pages/admin/ScanPanel.test.tsx index 2de25c5..effda68 100644 --- a/web/src/pages/admin/ScanPanel.test.tsx +++ b/web/src/pages/admin/ScanPanel.test.tsx @@ -48,7 +48,7 @@ const posts = (calls: RecordedCall[]) => calls.filter((c) => c.key === 'POST /ap beforeEach(async () => { vi.spyOn(navigator, 'language', 'get').mockReturnValue('en-US') await initI18n() - sessionStore.setState({ status: 'authenticated', user: { id: 1, username: 'tom', is_admin: true } }) + sessionStore.setState({ status: 'authenticated', user: { id: 1, email: 'tom@example.org', is_admin: true } }) }) test('after a scan it shows how it went, and the files Sonda cannot read yet stand out', async () => { diff --git a/web/src/pages/discover/MarkedList.test.tsx b/web/src/pages/discover/MarkedList.test.tsx index 9aac4e2..b7613e5 100644 --- a/web/src/pages/discover/MarkedList.test.tsx +++ b/web/src/pages/discover/MarkedList.test.tsx @@ -36,7 +36,7 @@ function wishlist(over: MockRoutes = {}): MockRoutes { beforeEach(async () => { vi.spyOn(navigator, 'language', 'get').mockReturnValue('en-US') await initI18n() - sessionStore.setState({ status: 'authenticated', user: { id: 1, username: 'tom', is_admin: false } }) + sessionStore.setState({ status: 'authenticated', user: { id: 1, email: 'tom@example.org', is_admin: false } }) }) test('an artist you have links to its page, one you only wish for is just a name', async () => { diff --git a/web/src/pages/discover/SeedPicker.test.tsx b/web/src/pages/discover/SeedPicker.test.tsx index ffa031e..bb8feb1 100644 --- a/web/src/pages/discover/SeedPicker.test.tsx +++ b/web/src/pages/discover/SeedPicker.test.tsx @@ -35,7 +35,7 @@ const box = () => screen.getByRole('searchbox', { name: 'Find an artist to start beforeEach(async () => { vi.spyOn(navigator, 'language', 'get').mockReturnValue('en-US') await initI18n() - sessionStore.setState({ status: 'authenticated', user: { id: 1, username: 'tom', is_admin: false } }) + sessionStore.setState({ status: 'authenticated', user: { id: 1, email: 'tom@example.org', is_admin: false } }) }) test('nothing is asked of the library until something is typed', async () => { diff --git a/web/src/pages/discover/SuggestionCard.test.tsx b/web/src/pages/discover/SuggestionCard.test.tsx index eed7494..ede0909 100644 --- a/web/src/pages/discover/SuggestionCard.test.tsx +++ b/web/src/pages/discover/SuggestionCard.test.tsx @@ -40,7 +40,7 @@ function renderCard(suggestion: Suggestion) { beforeEach(async () => { vi.spyOn(navigator, 'language', 'get').mockReturnValue('en-US') await initI18n() - sessionStore.setState({ status: 'authenticated', user: { id: 1, username: 'tom', is_admin: false } }) + sessionStore.setState({ status: 'authenticated', user: { id: 1, email: 'tom@example.org', is_admin: false } }) }) test('it names the artist with a link, the score in percent, and what it comes from', () => { @@ -62,7 +62,7 @@ test('an artist you have shows its photo', () => { }) test('an admin can request the artist on Lidarr from the card, and the card asks Lidarr nothing before that', async () => { - sessionStore.setState({ user: { id: 1, username: 'tom', is_admin: true } }) + sessionStore.setState({ user: { id: 1, email: 'tom@example.org', is_admin: true } }) const { calls } = mockFetch({}) renderCard(make()) expect(screen.getByRole('button', { name: 'Request on Lidarr' })).toBeInTheDocument() diff --git a/web/src/pages/discover/SuggestionsTab.test.tsx b/web/src/pages/discover/SuggestionsTab.test.tsx index 2a15aa9..23cebdb 100644 --- a/web/src/pages/discover/SuggestionsTab.test.tsx +++ b/web/src/pages/discover/SuggestionsTab.test.tsx @@ -54,7 +54,7 @@ const discoverCalls = (calls: RecordedCall[]) => calls.filter((c) => c.key === ' beforeEach(async () => { vi.spyOn(navigator, 'language', 'get').mockReturnValue('en-US') await initI18n() - sessionStore.setState({ status: 'authenticated', user: { id: 1, username: 'tom', is_admin: false } }) + sessionStore.setState({ status: 'authenticated', user: { id: 1, email: 'tom@example.org', is_admin: false } }) }) test('with no starting artist and your listening not allowed, nothing is sent and you are invited to pick', async () => { diff --git a/web/src/pages/discover/TastePanel.test.tsx b/web/src/pages/discover/TastePanel.test.tsx index 002255e..8cb8471 100644 --- a/web/src/pages/discover/TastePanel.test.tsx +++ b/web/src/pages/discover/TastePanel.test.tsx @@ -18,7 +18,7 @@ function renderPanel() { beforeEach(async () => { vi.spyOn(navigator, 'language', 'get').mockReturnValue('en-US') await initI18n() - sessionStore.setState({ status: 'authenticated', user: { id: 1, username: 'tom', is_admin: false } }) + sessionStore.setState({ status: 'authenticated', user: { id: 1, email: 'tom@example.org', is_admin: false } }) }) test('it shows the kinds of music and the artists you like', async () => { diff --git a/web/src/pages/pages.test.tsx b/web/src/pages/pages.test.tsx index 63dc114..91ec687 100644 --- a/web/src/pages/pages.test.tsx +++ b/web/src/pages/pages.test.tsx @@ -372,7 +372,7 @@ test('an artist a provider named, with nothing to play, still has a page', async }) test('an admin gets the Lidarr button on the page of an artist they have nothing of', async () => { - sessionStore.setState({ user: { id: 1, username: 'tom', is_admin: true } }) + sessionStore.setState({ user: { id: 1, email: 'tom@example.org', is_admin: true } }) mockFetch( artistRoutes({ 'GET /api/v1/artists/5': () => ({ ...artist, album_count: 0, track_count: 0 }),