fix: mock data not using correct date format

This commit is contained in:
xenticore
2025-04-30 18:32:02 -04:00
parent 5e5846abde
commit 39ad61b768

View File

@@ -35,7 +35,7 @@ describe('Price Service', () => {
const mockCachedData: ItemPriceData = { const mockCachedData: ItemPriceData = {
sku: mockSku, sku: mockSku,
update: new Date(Date.now() - 15 * 60 * 1000), // 15 minutes ago update: new Date(Date.now() - 15 * 60 * 1000).getTime(), // 15 minutes ago
ttl: mockTtl, ttl: mockTtl,
keys: 1, keys: 1,
metal: 21.11, metal: 21.11,
@@ -56,7 +56,7 @@ describe('Price Service', () => {
}) })
test('fetchPrice fetches new data when cache is expired', async () => { test('fetchPrice fetches new data when cache is expired', async () => {
const expiredCache: ItemPriceData = { ...mockCachedData, update: new Date(Date.now() - 2 * mockTtl) }; const expiredCache: ItemPriceData = { ...mockCachedData, update: new Date(Date.now() - 2 * mockTtl).getTime() };
(getStorageValue as jest.Mock).mockResolvedValue(expiredCache); (getStorageValue as jest.Mock).mockResolvedValue(expiredCache);
(priceUsingPricesTF as jest.Mock).mockResolvedValue(mockPriceResponse) (priceUsingPricesTF as jest.Mock).mockResolvedValue(mockPriceResponse)