fix: test issues

This commit is contained in:
Eli Bosley
2025-01-28 14:09:35 -05:00
parent 5afa76043f
commit 4d8f2ddac6

View File

@@ -23,6 +23,7 @@ describe('AuthResolver', () => {
description: 'Test API Key Description', description: 'Test API Key Description',
roles: [Role.GUEST], roles: [Role.GUEST],
createdAt: new Date().toISOString(), createdAt: new Date().toISOString(),
permissions: []
}; };
const mockApiKeyWithSecret: ApiKeyWithSecret = { const mockApiKeyWithSecret: ApiKeyWithSecret = {
@@ -32,6 +33,7 @@ describe('AuthResolver', () => {
description: 'Test API Key Description', description: 'Test API Key Description',
roles: [Role.GUEST], roles: [Role.GUEST],
createdAt: new Date().toISOString(), createdAt: new Date().toISOString(),
permissions: []
}; };
beforeEach(async () => { beforeEach(async () => {
@@ -84,6 +86,7 @@ describe('AuthResolver', () => {
name: 'New API Key', name: 'New API Key',
description: 'New API Key Description', description: 'New API Key Description',
roles: [Role.GUEST], roles: [Role.GUEST],
permissions: []
}; };
vi.spyOn(apiKeyService, 'create').mockResolvedValue(mockApiKeyWithSecret); vi.spyOn(apiKeyService, 'create').mockResolvedValue(mockApiKeyWithSecret);
@@ -92,11 +95,12 @@ describe('AuthResolver', () => {
const result = await resolver.createApiKey(input); const result = await resolver.createApiKey(input);
expect(result).toEqual(mockApiKeyWithSecret); expect(result).toEqual(mockApiKeyWithSecret);
expect(apiKeyService.create).toHaveBeenCalledWith( expect(apiKeyService.create).toHaveBeenCalledWith({
input.name, name: input.name,
input.description, description: input.description,
input.roles roles: input.roles,
); permissions: [],
});
expect(authService.syncApiKeyRoles).toHaveBeenCalledWith(mockApiKey.id, mockApiKey.roles); expect(authService.syncApiKeyRoles).toHaveBeenCalledWith(mockApiKey.id, mockApiKey.roles);
}); });
}); });