refs #6915 test_master24_8 #2067

Merged
alexm merged 561 commits from test_master24_8 into master 2024-02-22 07:31:34 +00:00
1 changed files with 32 additions and 0 deletions
Showing only changes of commit 59ea47a8c3 - Show all commits

View File

@ -36,6 +36,26 @@ describe('Worker new', () => {
payMethodFk: 1,
roleFk: 1
};
const clientWorker = {
fi: '09412983A',
name: 'CLIENTWORKER',
firstName: 'CLIENT',
lastNames: 'WORKER',
email: 'clientWorker@mydomain.com',
street: 'S/ DEFAULTWORKERSTREET',
city: 'defaultWorkerCity',
provinceFk: 1,
companyFk: 442,
postcode: '46680',
phone: '123456489',
code: 'CCW',
bossFk: 9,
birth: '2022-12-11T23:00:00.000Z',
payMethodFk: 1,
roleFk: 1
};
const req = {accessToken: {userId: 9}};
it('should return error if personal mail already exists', async() => {
@ -149,6 +169,18 @@ describe('Worker new', () => {
expect(newWorker.id).toBeDefined();
});
it('should create a new client', async() => {
const newWorker = await models.Worker.new({args: clientWorker, req});
await models.Worker.destroyById(newWorker.id);
await models.Address.destroyAll({clientFk: newWorker.id});
await models.Mandate.destroyAll({clientFk: newWorker.id});
await models.Client.destroyById(newWorker.id);
await models.VnUser.destroyById(newWorker.id);
expect(newWorker.id).toBeDefined();
});
it('should create a new worker in client', async() => {
const bruceWayneId = 1101;
const client = await models.Client.findById(bruceWayneId, {fields: ['fi', 'email']});