【发布时间】:2020-01-04 07:45:24
【问题描述】:
我正在编写一些代码来测试 Zapier 的 CLI 中的操作。我想在这里再添加一个条件,例如response.status == 200 or 201;,以检查 API 响应代码是 200 还是 201。
我该怎么做?当我记录响应时,它给了我整个 JSON 对象 API 正在返回。
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);
});
});
【问题讨论】:
标签: zapier zapier-cli