22 lines
672 B
JavaScript
22 lines
672 B
JavaScript
describe('Pokemon API Tests', () => {
|
|
beforeEach(() => {
|
|
cy.visit('http://localhost:4200')
|
|
})
|
|
|
|
it('should get the database', () => {
|
|
/*https://docs.cypress.io/api/commands/request*/
|
|
cy.request('GET', 'https://pokeapi.co/api/v2/pokemon')
|
|
.then((response) => {
|
|
// 200 = OK
|
|
expect(response.status).to.eq(200)
|
|
const pokeData = response.body
|
|
expect(pokeData).to.have.property('count')
|
|
expect(pokeData.count).to.be.a('number')
|
|
expect(pokeData.next).to.be.a('string')
|
|
expect(pokeData.results[0]).to.have.property('name')
|
|
expect(pokeData.results[0].name).to.eq('bulbasaur')
|
|
})
|
|
})
|
|
|
|
})
|