7525-devToTest #2542
|
@ -51,7 +51,7 @@ describe('Client Add address path', () => {
|
||||||
await page.waitToClick(selectors.clientAddresses.saveButton);
|
await page.waitToClick(selectors.clientAddresses.saveButton);
|
||||||
const message = await page.waitForSnackbar();
|
const message = await page.waitForSnackbar();
|
||||||
|
|
||||||
expect(message.text).toContain('Incoterms is required for a non UEE member');
|
expect(message.text).toContain('Incoterms and Customs agent are required for a non UEE member');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should receive an error after clicking save button as customsAgent is empty`, async() => {
|
it(`should receive an error after clicking save button as customsAgent is empty`, async() => {
|
||||||
|
|
|
@ -226,5 +226,6 @@
|
||||||
"This password can only be changed by the user themselves": "This password can only be changed by the user themselves",
|
"This password can only be changed by the user themselves": "This password can only be changed by the user themselves",
|
||||||
"They're not your subordinate": "They're not your subordinate",
|
"They're not your subordinate": "They're not your subordinate",
|
||||||
"InvoiceIn is already booked": "InvoiceIn is already booked",
|
"InvoiceIn is already booked": "InvoiceIn is already booked",
|
||||||
"This workCenter is already assigned to this agency": "This workCenter is already assigned to this agency"
|
"This workCenter is already assigned to this agency": "This workCenter is already assigned to this agency",
|
||||||
|
"Incoterms and Customs agent are required for a non UEE member": "Incoterms and Customs agent are required for a non UEE member"
|
||||||
}
|
}
|
|
@ -92,11 +92,12 @@ module.exports = function(Self) {
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
const isUeeMember = province.country().isUeeMember;
|
const isUeeMember = province.country().isUeeMember;
|
||||||
if (!isUeeMember && !args.incotermsFk)
|
if (!isUeeMember && (!args.incotermsFk || !args.customsAgentFk)) {
|
||||||
throw new UserError(`Incoterms is required for a non UEE member`);
|
if (!args.incotermsFk)
|
||||||
|
throw new UserError(`Incoterms and Customs agent are required for a non UEE member`);
|
||||||
if (!isUeeMember && !args.customsAgentFk)
|
else
|
||||||
throw new UserError(`Customs agent is required for a non UEE member`);
|
throw new UserError(`Customs agent is required for a non UEE member`);
|
||||||
|
}
|
||||||
|
|
||||||
delete args.ctx; // Remove unwanted properties
|
delete args.ctx; // Remove unwanted properties
|
||||||
const newAddress = await models.Address.create(args, myOptions);
|
const newAddress = await models.Address.create(args, myOptions);
|
||||||
|
|
|
@ -50,7 +50,7 @@ describe('Address createAddress', () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
expect(error).toBeDefined();
|
expect(error).toBeDefined();
|
||||||
expect(error.message).toEqual('Incoterms is required for a non UEE member');
|
expect(error.message).toEqual('Incoterms and Customs agent are required for a non UEE member');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should throw a non uee member error if no customsAgent is defined', async() => {
|
it('should throw a non uee member error if no customsAgent is defined', async() => {
|
||||||
|
|
Loading…
Reference in New Issue