I have the following code:
it('should return a number', async () => {
const exchangeRate = await getExchangeRate('USD','HUF')
expect(exchangeRate).toBe()
})
How can I build this test so that I can use the expect()
method to check if the exchangeRate
const is a float number or just a number ? ....
You can assert the type of the value by using typeof
:
expect(typeof exchangeRate === 'number').toBe(true)