feat(ui): add follow button, follows card, and inbox page
Build, Test & Push Frontend / quality-check (push) Successful in 34s
Build, Test & Push Frontend / docker (push) Successful in 23s

This commit is contained in:
lobo committed 2026-10-06 16:22:22 +02:00
1 parent 3aed243e35
commit 43c4862606
23 files changed
+603 -2

No files matched your search

+29
View File
@@ -25,6 +25,7 @@ function mockBackends({name = 'Lobo', profileStatus = 200, libraryStatus = 200,
...(me && {
'GET /api/users/me': json(200, me),
'PUT /api/users/settings/profile-tiles': json(204, {}),
'GET /api/follows': json(200, {following: [], followers: []}),
}),
});
}
@@ -238,6 +239,34 @@ describe('PublicProfilePage', () => {
}
});
it('offers "Follow" to a logged-in visitor, not to the owner and not to a guest', async () => {
localStorage.setItem('tbp_session', '1');
try {
mockBackends({me: {displayName: 'Someone', role: 'USER'}});
const visitor = renderPage();
expect(await screen.findByRole('button', {name: 'FOLLOW.FOLLOW'})).toBeTruthy();
visitor.unmount();
mockBackends({me: {displayName: 'Lobo', role: 'USER'}});
renderPage();
await screen.findByRole('button', {name: 'TILES.CUSTOMIZE'});
expect(screen.queryByRole('button', {name: 'FOLLOW.FOLLOW'})).toBeNull();
expect(fetch).not.toHaveBeenCalledWith(expect.stringContaining('/api/follows'), expect.anything());
} finally {
localStorage.clear();
}
});
it('offers no "Follow" to a guest', async () => {
mockBackends();
renderPage();
await screen.findByText('Portal 2');
expect(screen.queryByRole('button', {name: 'FOLLOW.FOLLOW'})).toBeNull();
expect(fetch).not.toHaveBeenCalledWith(expect.stringContaining('/api/follows'), expect.anything());
});
it('shows no "Customize" to a visitor', async () => {
localStorage.setItem('tbp_session', '1');
try {