backend-test-utils: make mock token manager check for mock tokens
Co-authored-by: Fredrik Adelöw <freben@gmail.com> Co-authored-by: blam <ben@blam.sh> Co-authored-by: Johan Haals <johan.haals@gmail.com> Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -23,7 +23,11 @@ class TokenManagerMock implements TokenManager {
|
||||
async getToken(): Promise<{ token: string }> {
|
||||
return { token: 'mock-token' };
|
||||
}
|
||||
async authenticate(): Promise<void> {}
|
||||
async authenticate(token: string): Promise<void> {
|
||||
if (token !== 'mock-token') {
|
||||
throw new Error('Invalid token');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const mockTokenManagerFactory = createServiceFactory({
|
||||
|
||||
Reference in New Issue
Block a user