This commit is contained in:
2025-01-01 23:45:40 +01:00
parent 14cdc06de5
commit 20ba36c052
3 changed files with 47 additions and 1 deletions

View File

@@ -0,0 +1,21 @@
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')
})
})
})