fix: refs #7906 add test
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Carlos Satorres 2024-10-18 08:28:08 +02:00
parent 3f3b936255
commit 02dc952024
1 changed files with 16 additions and 1 deletions

View File

@ -9,8 +9,8 @@ describe('zone deletezone()', () => {
};
const ctx = {req: activeCtx};
const zoneId = 4;
const zoneId2 = 3;
let ticketIDs;
let originalTicketStates;
beforeAll(async() => {
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
@ -44,4 +44,19 @@ describe('zone deletezone()', () => {
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();
}
});
});