5638-ticket.summary_states #1538
|
@ -24,31 +24,6 @@ describe('ticket editableStates()', () => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should return the expected states by a specific role`, async() => {
|
|
||||||
const tx = await models.State.beginTransaction({});
|
|
||||||
|
|
||||||
try {
|
|
||||||
const options = {transaction: tx};
|
|
||||||
|
|
||||||
const salesPerson = 18;
|
|
||||||
const ctx = {req: {accessToken: {userId: salesPerson}}};
|
|
||||||
|
|
||||||
const editableStates = await models.State.editableStates(ctx, filter, options);
|
|
||||||
|
|
||||||
const deliveredState = editableStates.some(state => state.code == 'DELIVERED');
|
|
||||||
|
|
||||||
const pickerDesignedState = editableStates.some(state => state.code == 'PICKER_DESIGNED');
|
|
||||||
|
|
||||||
expect(deliveredState).toBeFalsy();
|
|
||||||
expect(pickerDesignedState).toBeTruthy();
|
|
||||||
|
|
||||||
await tx.rollback();
|
|
||||||
} catch (e) {
|
|
||||||
await tx.rollback();
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
it(`should return again the expected state by a specific role`, async() => {
|
it(`should return again the expected state by a specific role`, async() => {
|
||||||
const tx = await models.State.beginTransaction({});
|
const tx = await models.State.beginTransaction({});
|
||||||
|
|
||||||
|
@ -70,4 +45,25 @@ describe('ticket editableStates()', () => {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it(`should return the expected state matching with the name`, async() => {
|
||||||
|
const tx = await models.State.beginTransaction({});
|
||||||
|
|
||||||
|
try {
|
||||||
|
const options = {transaction: tx};
|
||||||
|
|
||||||
|
const employeeRole = 1;
|
||||||
|
const ctx = {req: {accessToken: {userId: employeeRole}}};
|
||||||
|
const filter = {where: {name: {like: '%Previa OK%'}}};
|
||||||
|
|
||||||
|
const [editableStates] = await models.State.editableStates(ctx, filter, options);
|
||||||
|
|
||||||
|
expect(editableStates.name).toBe('Previa OK');
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue