Improve messaging and dashboard reliability
This commit is contained in:
1 parent
345ec99348
commit
5a5a30a1d4
20 files changed
+406
-56
No files matched your search
@@ -2,6 +2,7 @@ import { describe, it, expect, vi } from 'vitest';
|
||||
import {
|
||||
MatrixAuthError,
|
||||
MatrixClient,
|
||||
MatrixFeatureDisabledError,
|
||||
MatrixRateLimitError,
|
||||
} from '../src/services/chat/matrix/client.js';
|
||||
import { createMockLogger } from './mockLogger.js';
|
||||
@@ -153,6 +154,18 @@ describe('MatrixClient direct room registration', () => {
|
||||
});
|
||||
|
||||
describe('MatrixClient authentication classification', () => {
|
||||
it('classifies an explicitly disabled endpoint as an unavailable feature', async () => {
|
||||
const client = new MatrixClient(creds, createMockLogger(), {
|
||||
minRequestIntervalMs: 0,
|
||||
fetchImpl: vi.fn().mockResolvedValue(new Response(JSON.stringify({
|
||||
message: 'disabled by configuration',
|
||||
}), { status: 403, headers: { 'content-type': 'application/json' } })),
|
||||
});
|
||||
|
||||
await expect(client.getRoomFullState('!room:example.test'))
|
||||
.rejects.toBeInstanceOf(MatrixFeatureDisabledError);
|
||||
});
|
||||
|
||||
it('does not classify a room-level 403 as an expired account token', async () => {
|
||||
const client = new MatrixClient(creds, createMockLogger(), {
|
||||
minRequestIntervalMs: 0,
|
||||
|
||||
Reference in new issue
Block a user