This commit is contained in:
parent
3f3b936255
commit
02dc952024
|
@ -9,8 +9,8 @@ describe('zone deletezone()', () => {
|
||||||
};
|
};
|
||||||
const ctx = {req: activeCtx};
|
const ctx = {req: activeCtx};
|
||||||
const zoneId = 4;
|
const zoneId = 4;
|
||||||
|
const zoneId2 = 3;
|
||||||
let ticketIDs;
|
let ticketIDs;
|
||||||
let originalTicketStates;
|
|
||||||
|
|
||||||
beforeAll(async() => {
|
beforeAll(async() => {
|
||||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||||
|
@ -44,4 +44,19 @@ describe('zone deletezone()', () => {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should not delete the zone if it has tickets', async() => {
|
||||||
|
const tx = await models.Zone.beginTransaction({});
|
||||||
|
|
||||||
|
try {
|
||||||
|
const options = {transaction: tx};
|
||||||
|
await models.Zone.deleteZone(ctx, zoneId2, options);
|
||||||
|
|
||||||
|
expect(e.message).toEqual('There are tickets for this area, delete them first');
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue