Files
api_test/apiTest/PotterAPI/AI/AI - Get random house.yml
T
2026-09-15 20:50:51 +02:00

48 lines
1.2 KiB
YAML

info:
name: AI - Get random house
type: http
seq: 2
http:
method: GET
url: http://localhost:3000/sortingHat
auth: inherit
runtime:
scripts:
- type: tests
code: |-
const status = res.getStatus()
const body = res.getBody()
test("Status code is 200", function() {
expect(status).to.equal(200);
});
test("Response should contain sortingHatSays key", function(){
expect(body).to.contain.key("sortingHatSays")
})
test("Response should contain house key", function(){
expect(body).to.contain.key("house")
})
test("sortingHatSays should not be empty", function(){
expect(body.sortingHatSays).not.to.be.empty
})
test("House should be one of the four Hogwarts houses", function(){
expect(body.house).is.oneOf(["Gryffindor", "Slytherin", "Ravenclaw", "Hufflepuff"])
})
test("Response time is less than 600 ms", function(){
expect(res.responseTime).to.be.below(600)
})
settings:
encodeUrl: true
timeout: 0
followRedirects: true
maxRedirects: 5
forwardAuthorizationHeader: false