mirror of
https://github.com/unraid/api.git
synced 2026-01-03 15:09:48 -06:00
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:
@@ -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 () => {
|
||||
|
||||
Reference in New Issue
Block a user