price-point-api/bruno/chains/create-chain.bru

49 lines
861 B
Text
Raw Normal View History

meta {
name: Create Chain
type: http
seq: 2
}
post {
url: {{baseUrl}}/chains
body: json
}
headers {
Content-Type: application/json
Authorization: Bearer {{authToken}}
}
body:json {
{
"chain": {
"name": "Test Chain Store"
}
}
}
assert {
res.status: equals 201
}
script:post-response {
const body = res.getBody();
if (body && body.id) {
bru.setVar("chainId", body.id);
}
}
tests {
test("Create chain returns chain object directly", function() {
const data = res.getBody();
expect(data).to.have.property("id");
expect(data).to.have.property("name");
expect(data).to.have.property("created_at");
expect(data).to.have.property("updated_at");
});
test("Created chain has correct name", function() {
const data = res.getBody();
expect(data.name).to.equal("Test Chain Store");
});
}