chore: fix flaky api key test (#1357)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Tests**
- Improved test validations to flexibly verify dynamic timestamp values
in API responses.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Eli Bosley
2025-04-14 11:45:45 -04:00
committed by GitHub
parent 234573264c
commit 33ad1fd63b

View File

@@ -317,8 +317,8 @@ describe('ApiKeyService', () => {
],
};
expect(result[0]).toEqual(expectedApiKey1);
expect(result[1]).toEqual(expectedApiKey2);
expect(result[0]).toMatchObject({ ...expectedApiKey1, createdAt: expect.any(String) });
expect(result[1]).toMatchObject({ ...expectedApiKey2, createdAt: expect.any(String) });
});
it('should handle file read errors gracefully', async () => {
@@ -334,7 +334,7 @@ describe('ApiKeyService', () => {
const result = await apiKeyService.findById(mockApiKeyWithSecret.id);
expect(result).toEqual(mockApiKey);
expect(result).toMatchObject({ ...mockApiKey, createdAt: expect.any(String) });
});
it('should return null if API key not found', async () => {