Updated unit test
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
ad11a92c87
commit
d0ece57219
|
@ -1,7 +1,7 @@
|
|||
const app = require('vn-loopback/server/server');
|
||||
const LoopBackContext = require('loopback-context');
|
||||
|
||||
fdescribe('Worker deleteAbsence()', () => {
|
||||
describe('Worker deleteAbsence()', () => {
|
||||
const workerId = 18;
|
||||
let createdAbsence;
|
||||
const activeCtx = {
|
||||
|
@ -17,7 +17,9 @@ fdescribe('Worker deleteAbsence()', () => {
|
|||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||
active: activeCtx
|
||||
});
|
||||
const businessId = 106;
|
||||
|
||||
activeCtx.accessToken.userId = 106;
|
||||
const businessId = 18;
|
||||
createdAbsence = await app.models.Calendar.create({
|
||||
businessFk: businessId,
|
||||
dayOffTypeFk: 1,
|
||||
|
@ -25,7 +27,7 @@ fdescribe('Worker deleteAbsence()', () => {
|
|||
});
|
||||
|
||||
let error;
|
||||
await app.models.Worker.deleteAbsence(ctx, workerId, createdAbsence.id).catch(e => {
|
||||
await app.models.Worker.deleteAbsence(ctx, 18, createdAbsence.id).catch(e => {
|
||||
error = e;
|
||||
}).finally(() => {
|
||||
expect(error.message).toEqual(`You don't have enough privileges`);
|
||||
|
@ -38,7 +40,9 @@ fdescribe('Worker deleteAbsence()', () => {
|
|||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||
active: activeCtx
|
||||
});
|
||||
const businessId = 106;
|
||||
|
||||
activeCtx.accessToken.userId = 19;
|
||||
const businessId = 18;
|
||||
|
||||
expect(createdAbsence.businessFk).toEqual(businessId);
|
||||
|
||||
|
|
Loading…
Reference in New Issue