tweaks
This commit is contained in:
+16
-2
@@ -194,6 +194,20 @@ async function run(port) {
|
||||
|
||||
const dealerToken = await approveDealer('94772222222', adminToken);
|
||||
|
||||
const ownStock = await request(port, 'POST', '/api/stocks', {
|
||||
token: dealerToken,
|
||||
body: {
|
||||
chassisNumber: 'CH-OWN',
|
||||
engineNumber: 'EN-OWN',
|
||||
model: 'gn125',
|
||||
color: 'Red',
|
||||
currentDealerId: dealerA.json.data.id,
|
||||
},
|
||||
});
|
||||
assert(
|
||||
ownStock.status === 201 && ownStock.json.data.currentDealerId === dealerA.json.data.id,
|
||||
`dealer should add stock to their own dealership ${ownStock.status}`
|
||||
);
|
||||
const forbiddenStock = await request(port, 'POST', '/api/stocks', {
|
||||
token: dealerToken,
|
||||
body: {
|
||||
@@ -201,10 +215,10 @@ async function run(port) {
|
||||
engineNumber: 'ENG-NOPE',
|
||||
model: 'gn125',
|
||||
color: 'Red',
|
||||
currentDealerId: dealerA.json.data.id,
|
||||
currentDealerId: dealerB.json.data.id,
|
||||
},
|
||||
});
|
||||
assert(forbiddenStock.status === 403, 'dealer should not add stock');
|
||||
assert(forbiddenStock.status === 403, 'dealer should not add stock to another dealership');
|
||||
|
||||
async function addStock(chassis, engine, days, dealerId) {
|
||||
const created = await request(port, 'POST', '/api/stocks', {
|
||||
|
||||
Reference in New Issue
Block a user