it('should return the error', async () => {
const mockError = new Error('Failed to load markets')
const mockLoadMarkets = spyOn(
exchange,
'loadMarkets',
).mockImplementationOnce(async () => {
return await Promise.reject(mockError)
})
expect(async () => {
await Fx.runPromise(loadMarketsE(exchange))
}).toThrowError(mockError)
mockLoadMarkets.mockRestore()
})
it('should return the error', async () => {
const mockError = new Error('Failed to load markets')
const mockLoadMarkets = spyOn(
exchange,
'loadMarkets',
).mockImplementationOnce(async () => {
return await Promise.reject(mockError)
})
expect(async () => {
await Fx.runPromise(loadMarketsE(exchange))
}).toThrowError(mockError)
mockLoadMarkets.mockRestore()
})