'How to verify api axios respond with a few elements, arrays
it('should get a new joke upon each request', async function () { const respondTwo = await axios.get('https://sandbox.iexapis.com/stable/stock/market/batch?symbols=tsla,fb&types=quote,news,chart&range=1m&last=5&token=Tsk_456ccaccad6f455886f60ab0529a0345')
// .then((resp) => {
// const stock = resp[0].symbol
// return stock
// })
// .then((stock) => {
// })
let tsla = respondTwo.data
let fb = respondTwo.data
console.log(tsla)
console.log(fb)
expect(tsla.TSLA).to.have.property('symbol', TSLA)
//expect(tsla.TSLA.symbol).to.deep.equal('TSLA')
// expect(fb.companyName).to.equal('Facebook')
// expect(respond.data.symbol).to.equal('AAPL')
// chai.assert.isBoolean(respond.data.isUSMarketOpen);
//expect(tsla.status).to.deep.equal(200)
//expect(tsla.status).to.equal(200)
This is what i tried but on my response i getting 2 stocks so how to verify first or second if its in an array, do i need to chain it somehow?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
