feat(admin): add the admin users page and view as
Build, Test & Push Frontend / quality-check (push) Successful in 17s
Build, Test & Push Frontend / docker (push) Successful in 28s

This commit is contained in:
lobo committed 2026-09-27 12:18:10 +02:00
1 parent 46587dfb5c
commit afe00ceae9
14 files changed
+649 -8

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
// @vitest-environment jsdom
import {describe, expect, it, vi} from 'vitest';
import {refreshSession} from './api.js';
import {viewAs} from './admin.js';
describe('viewAs', () => {
it('waits for a running refresh before it sends the refresh cookie', async () => {
let finishRefresh;
globalThis.fetch = vi.fn((url) => (url.endsWith('/api/auth/refresh')
? new Promise((resolve) => {
finishRefresh = () => resolve({ok: true, status: 204});
})
: Promise.resolve({ok: true, status: 204})));
const refreshing = refreshSession();
const switching = viewAs('USER');
await Promise.resolve();
expect(fetch.mock.calls.map(([url]) => url).filter((url) => url.endsWith('/api/auth/view-as'))).toHaveLength(0);
finishRefresh();
await refreshing;
await switching;
});
});