Reputation: 1227
I'm making an API call and want to verify that it succeeded. Something like this:
var response = await api.ensureSettings(data);
expect(response.code).toBe(200);
How can I check equivalence in codeceptjs?
Upvotes: 0
Views: 997
Reputation: 28
you have to use additional libraries either codeceptjs chai or codeceptjs assert library
"codeceptjs-assert": "0.0.4", "codeceptjs-chai": "^1.0.0",
I.assertStrictEqual(response.code, 200)
Upvotes: 0
Reputation: 176
You can use it with chai http://chaijs.com/. After install chai just do:
var expect = require('chai').expect;
on top of your test script, than you can use
expect(response.code).to.be.equal(200);
I recommend you use postman/newman to testing your Api, but you could do it too with codeceptjs.
Upvotes: 1