Public Access
feat(ui): add follow button, follows card, and inbox page
This commit is contained in:
1 parent
3aed243e35
commit
43c4862606
23 files changed
+603
-2
No files matched your search
@@ -18,7 +18,8 @@ afterEach(() => {
|
||||
|
||||
const loggedInAs = (me, routes = {}) => {
|
||||
localStorage.setItem('tbp_session', '1');
|
||||
fetchRoutes({'GET /api/users/me': json(200, me), 'GET /api/library/steam-profile': json(200, {}), ...routes});
|
||||
fetchRoutes({'GET /api/users/me': json(200, me), 'GET /api/library/steam-profile': json(200, {}),
|
||||
'GET /api/inbox': json(200, {results: [], unread: 0}), ...routes});
|
||||
renderWithProviders(<AppHeader isAuthenticated onLogout={() => {}}/>);
|
||||
};
|
||||
|
||||
@@ -45,6 +46,23 @@ describe('AppHeader', () => {
|
||||
expect(screen.getByRole('link', {name: 'ToBePlayed'})).toBeTruthy();
|
||||
});
|
||||
|
||||
it('shows how many inbox notes are unread', async () => {
|
||||
loggedInAs({role: 'USER', activeRole: 'USER'}, {'GET /api/inbox': json(200, {results: [], unread: 3})});
|
||||
|
||||
const link = await screen.findByRole('link', {name: 'NAV.INBOX_UNREAD:3'});
|
||||
|
||||
expect(link.getAttribute('href')).toBe('/inbox');
|
||||
expect(link.textContent).toBe('3');
|
||||
});
|
||||
|
||||
it('shows no count without unread notes', async () => {
|
||||
loggedInAs({role: 'USER', activeRole: 'USER'});
|
||||
|
||||
const link = await screen.findByRole('link', {name: 'NAV.INBOX'});
|
||||
|
||||
expect(link.textContent).toBe('');
|
||||
});
|
||||
|
||||
it('offers the admin page and "view as" to an admin', async () => {
|
||||
loggedInAs({role: 'PLATFORM_ADMIN', activeRole: 'PLATFORM_ADMIN'},
|
||||
{'GET /api/admin/users/pending-count': json(200, {count: 0})});
|
||||
|
||||
Reference in new issue
Block a user