Tarea #545 /ticket/isEditable.js Backend unit tests

This commit is contained in:
gerard 2018-08-07 15:38:44 +02:00
parent 3b3bc52b53
commit f2be6cac17
1 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,27 @@
const app = require(`${servicesDir}/ticket/server/server`);
describe('ticket isEditable()', () => {
it('should return false if the ticket given is not editable', async() => {
let result = await app.models.Ticket.isEditable(2);
expect(result).toEqual(false);
});
it('should return false if the ticket given does not exists', async() => {
let result = await app.models.Ticket.isEditable(99999);
expect(result).toEqual(false);
});
it('should return false if the ticket given isDeleted', async() => {
let result = await app.models.Ticket.isEditable(21);
expect(result).toEqual(false);
});
it('should return true if the ticket given is editable', async() => {
let result = await app.models.Ticket.isEditable(1);
expect(result).toEqual(true);
});
});