chore: finishing unit tests for a couple of services (#13292)

This commit is contained in:
Daniel Dietzler
2024-10-08 23:08:49 +02:00
committed by GitHub
parent f5e0cdedbc
commit 9d0f03808c
17 changed files with 386 additions and 8 deletions

View File

@@ -46,6 +46,15 @@ describe(APIKeyService.name, () => {
expect(cryptoMock.newPassword).toHaveBeenCalled();
expect(cryptoMock.hashSha256).toHaveBeenCalled();
});
it('should throw an error if the api key does not have sufficient permissions', async () => {
await expect(
sut.create(
{ ...authStub.admin, apiKey: { ...keyStub.admin, permissions: [] } },
{ permissions: [Permission.ASSET_READ] },
),
).rejects.toBeInstanceOf(BadRequestException);
});
});
describe('update', () => {