You've already forked tf2wikipricing
fix: mock data not using correct date format
This commit is contained in:
@@ -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)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user