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:
Patrik Oldsberg
2023-01-10 15:20:11 +01:00
committed by blam
parent ac993deb18
commit 5541715237
@@ -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({