56 lines
1.1 KiB
Text
56 lines
1.1 KiB
Text
|
|
meta {
|
||
|
|
name: Create Store
|
||
|
|
type: http
|
||
|
|
seq: 2
|
||
|
|
}
|
||
|
|
|
||
|
|
post {
|
||
|
|
url: {{baseUrl}}/stores
|
||
|
|
body: json
|
||
|
|
}
|
||
|
|
|
||
|
|
headers {
|
||
|
|
Content-Type: application/json
|
||
|
|
Authorization: Bearer {{authToken}}
|
||
|
|
}
|
||
|
|
|
||
|
|
body:json {
|
||
|
|
{
|
||
|
|
"store": {
|
||
|
|
"name": "Test Store Location",
|
||
|
|
"latitude": 40.7128,
|
||
|
|
"longitude": -74.006,
|
||
|
|
"chain_id": {{chainId}}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
assert {
|
||
|
|
res.status: equals 201
|
||
|
|
}
|
||
|
|
|
||
|
|
script:post-response {
|
||
|
|
const body = res.getBody();
|
||
|
|
if (body && body.id) {
|
||
|
|
bru.setVar("storeId", body.id);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
tests {
|
||
|
|
test("Create store returns store object directly", function() {
|
||
|
|
const data = res.getBody();
|
||
|
|
expect(data).to.have.property("id");
|
||
|
|
expect(data).to.have.property("name");
|
||
|
|
expect(data).to.have.property("latitude");
|
||
|
|
expect(data).to.have.property("longitude");
|
||
|
|
expect(data).to.have.property("chain_id");
|
||
|
|
expect(data).to.have.property("created_at");
|
||
|
|
expect(data).to.have.property("updated_at");
|
||
|
|
});
|
||
|
|
|
||
|
|
test("Created store has correct values", function() {
|
||
|
|
const data = res.getBody();
|
||
|
|
expect(data.name).to.equal("Test Store Location");
|
||
|
|
expect(data.chain_id).to.equal(Number(bru.getVar("chainId")));
|
||
|
|
});
|
||
|
|
}
|