Sync shared snapshot from dcfdb3d
Docker / Docker Build & Push (push) Successful in 6m0s

This commit is contained in:
Gabriel20xx committed 2026-09-14 09:36:48 +02:00
1 parent 8d7c2f69ff
commit a018f3da4c
18 files changed
+747 -46

No files matched your search

@@ -68,6 +68,25 @@ test('constructor trims whitespace and leaves an empty base URL empty', () => {
assert.equal(new AuthClient('').baseUrl, '');
});
test('setBaseUrl retargets a pending client (constructed with "") to its first real URL', async () => {
const client = new AuthClient('', {
fetchImpl: fakeFetch([{ status: 200, body: { valid: true, user_id: 7, username: 'gabriel', role: 'admin' } }]),
});
await assert.rejects(() => client.validate('good-token'), /no base URL/);
client.setBaseUrl('https://auth.example.com');
assert.equal(client.baseUrl, 'https://auth.example.com');
const user = await client.validate('good-token');
assert.deepEqual(user, { id: 7, username: 'gabriel', role: 'admin' });
});
test('setBaseUrl ignores a blank value, leaving the previous URL in place', () => {
const client = new AuthClient('https://auth.example.com');
client.setBaseUrl(' ');
assert.equal(client.baseUrl, 'https://auth.example.com');
});
test('validate resolves the user on a valid session', async () => {
const client = new AuthClient('https://auth.example.com', {
fetchImpl: fakeFetch([{ status: 200, body: { valid: true, user_id: 7, username: 'gabriel', role: 'admin' } }]),