7167-testToMaster_2414 #2244

Merged
alexm merged 643 commits from 7167-testToMaster_2414 into master 2024-04-04 05:32:41 +00:00
1 changed files with 0 additions and 32 deletions
Showing only changes of commit 3cb494c735 - Show all commits

View File

@ -30,43 +30,11 @@ describe('zone deletezone()', () => {
}
});
it('should NOT delete a zone if is included', async() => {
const tx = await models.Zone.beginTransaction({});
let isIncluded = false;
try {
const options = {transaction: tx};
const zoneIncluded = await models.ZoneIncluded.find({where: {zoneFk: zoneId}});
isIncluded = zoneIncluded.length > 0;
await models.Zone.deleteZone(ctx, zoneId, options);
} catch (e) {
expect(isIncluded).toBeTrue();
expect(e).not.toBeNull();
await tx.rollback();
}
});
it('should NOT delete a zone if is included check', async() => {
const tx = await models.Zone.beginTransaction({});
try {
const options = {transaction: tx};
await models.Zone.deleteZone(ctx, zoneId, options);
} catch (e) {
expect(e).not.toBeNull();
await tx.rollback();
}
});
it('should delete a zone and update their tickets', async() => {
const tx = await models.Zone.beginTransaction({});
try {
const options = {transaction: tx};
const zoneIncluded = await models.ZoneIncluded.find({where: {zoneFk: zoneId}}, options);
await models.ZoneIncluded.destroyById(zoneIncluded[0].id, options);
const zoneIncludedDeleted = await models.ZoneIncluded.find({where: {zoneFk: zoneId}}, options);
expect(zoneIncludedDeleted.length).toEqual(0);
await models.Zone.deleteZone(ctx, zoneId, options);