js method chaining code example
Example 1: javascript promise chain
promise
.then(...)
.then(...)
.then(...)
.catch(...)
coinflip(10)
.then(betAgain)
.then(betAgain)
.then(betAgain)
.then(result => {
console.log(`OMG, WE DID THIS! TIME TO TAKE ${result} HOME!`);
})
.catch(handleRejection);
Example 2: method chaining
given() .... --> RequestSpecification
.header accept() contentType()
.queryParam
.pathParam
.body
.log
.auth..
when() --->> RequestSender
.get() ------>> Response Object
.post()
.put()
.delete()
then() -----> ValidatableResponse
This is where assertion happen
.statusCode
.header accept() contentType()
.body( matchers goes here)
.log