Zapier の CLI でアクションをテストするコードを書いています。response.status == 200 or 201;ここで、 API 応答コードが 200 または 201 であることを確認するなどの条件をもう 1 つ追加します。
どうすればいいですか?応答をログに記録すると、API が返す JSON オブジェクト全体が返されます。
describe("contact create", () => {
it("should create a contact", done => {
const bundle = {
inputData: {
firstName: "Test",
lastName: "Contact",
email: "Contact@test.com",
mobileNumber: "+12125551234",
type: "contact"
}
};
appTester(App.creates.contact.operation.perform, bundle)
.then(response => {
// Need one more condition whether response status is 200 or 201.
response.should.not.be.an.Array();
response.should.have.property('id');
done();
})
.catch(done);
});
});