refactor: rewrite async promises as chain

This commit is contained in:
xenticore
2025-04-30 18:31:33 -04:00
parent 36550df749
commit 5e5846abde
4 changed files with 67 additions and 98 deletions

View File

@@ -69,7 +69,7 @@ describe('Price Service', () => {
})
test('fetchPrice rejects with 401 when no token provided', async () => {
await expect(fetchPrice('', mockDefIndex + ";" + mockQuality)).rejects.toBe(401)
await expect(fetchPrice('', mockDefIndex + ";" + mockQuality)).rejects.toThrow()
})
test('fetchPrice handles pricing API errors', async () => {
@@ -77,7 +77,8 @@ describe('Price Service', () => {
(priceUsingPricesTF as jest.Mock).mockRejectedValue(testError);
(getStorageValue as jest.Mock).mockResolvedValue(null)
await expect(fetchPrice(mockToken, mockDefIndex + ";" + mockQuality)).rejects.toBe(testError)
await expect(fetchPrice(mockToken, mockDefIndex + ";" + mockQuality)).rejects.toThrow()
})
})
test('fetchKeyPrice uses correct parameters', async () => {