This commit is contained in:
parent
c352a12d49
commit
5270693bdd
|
@ -39,7 +39,7 @@ describe('Item index path', () => {
|
||||||
it('should navigate forth and back to see the images column is still visible', async() => {
|
it('should navigate forth and back to see the images column is still visible', async() => {
|
||||||
const imageVisible = await nightmare
|
const imageVisible = await nightmare
|
||||||
.waitToClick(selectors.itemsIndex.searchResult)
|
.waitToClick(selectors.itemsIndex.searchResult)
|
||||||
.waitToClick(selectors.itemsIndex.goBackToModuleIndexButton)
|
.waitToClick(selectors.itemDescriptor.goBackToModuleIndexButton)
|
||||||
.waitToClick(selectors.itemsIndex.searchIcon)
|
.waitToClick(selectors.itemsIndex.searchIcon)
|
||||||
.wait(selectors.itemsIndex.searchResult)
|
.wait(selectors.itemsIndex.searchResult)
|
||||||
.isVisible(selectors.itemsIndex.firstItemImage);
|
.isVisible(selectors.itemsIndex.firstItemImage);
|
||||||
|
@ -76,7 +76,7 @@ describe('Item index path', () => {
|
||||||
it('should now navigate forth and back to see the ids column is now visible', async() => {
|
it('should now navigate forth and back to see the ids column is now visible', async() => {
|
||||||
const idVisible = await nightmare
|
const idVisible = await nightmare
|
||||||
.waitToClick(selectors.itemsIndex.searchResult)
|
.waitToClick(selectors.itemsIndex.searchResult)
|
||||||
.waitToClick(selectors.itemsIndex.goBackToModuleIndexButton)
|
.waitToClick(selectors.itemDescriptor.goBackToModuleIndexButton)
|
||||||
.waitToClick(selectors.itemsIndex.searchIcon)
|
.waitToClick(selectors.itemsIndex.searchIcon)
|
||||||
.wait(selectors.itemsIndex.searchResult)
|
.wait(selectors.itemsIndex.searchResult)
|
||||||
.isVisible(selectors.itemsIndex.firstItemId);
|
.isVisible(selectors.itemsIndex.firstItemId);
|
||||||
|
|
|
@ -48,5 +48,6 @@
|
||||||
"Extension format is invalid": "Extension format is invalid",
|
"Extension format is invalid": "Extension format is invalid",
|
||||||
"NO_ZONE_FOR_THIS_PARAMETERS": "NO_ZONE_FOR_THIS_PARAMETERS",
|
"NO_ZONE_FOR_THIS_PARAMETERS": "NO_ZONE_FOR_THIS_PARAMETERS",
|
||||||
"This client can't be invoiced": "This client can't be invoiced",
|
"This client can't be invoiced": "This client can't be invoiced",
|
||||||
"The introduced hour already exists": "The introduced hour already exists"
|
"The introduced hour already exists": "The introduced hour already exists",
|
||||||
|
"Invalid parameters to create a new ticket": "Invalid parameters to create a new ticket"
|
||||||
}
|
}
|
|
@ -48,9 +48,6 @@ module.exports = Self => {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (address.client().type().code === 'normal') {
|
if (address.client().type().code === 'normal') {
|
||||||
if (address.client().isFreezed)
|
|
||||||
throw new UserError(`You can't create an order for a frozen client`);
|
|
||||||
|
|
||||||
if (!address.client().isActive)
|
if (!address.client().isActive)
|
||||||
throw new UserError(`You can't create an order for a inactive client`);
|
throw new UserError(`You can't create an order for a inactive client`);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,21 +10,7 @@ describe('order new()', () => {
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should throw an error if the client is frozen', async() => {
|
it('should throw an error if the client isnt active', async() => {
|
||||||
let error;
|
|
||||||
let landed = new Date();
|
|
||||||
let addressFk = 125;
|
|
||||||
let agencyModeFk = 1;
|
|
||||||
|
|
||||||
await app.models.Order.new(landed, addressFk, agencyModeFk)
|
|
||||||
.catch(e => {
|
|
||||||
error = e;
|
|
||||||
});
|
|
||||||
|
|
||||||
expect(error).toEqual(new UserError(`You can't create an order for a frozen client`));
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should throw an error if the client isnt frozen and isnt active', async() => {
|
|
||||||
let error;
|
let error;
|
||||||
let landed = new Date();
|
let landed = new Date();
|
||||||
let addressFk = 6;
|
let addressFk = 6;
|
||||||
|
|
|
@ -45,9 +45,6 @@ module.exports = Self => {
|
||||||
agencyMode = await models.AgencyMode.findById(params.agencyModeFk);
|
agencyMode = await models.AgencyMode.findById(params.agencyModeFk);
|
||||||
|
|
||||||
if (address.client().type().code === 'normal' && (!agencyMode || agencyMode.code != 'refund')) {
|
if (address.client().type().code === 'normal' && (!agencyMode || agencyMode.code != 'refund')) {
|
||||||
if (address.client().isFreezed)
|
|
||||||
throw new UserError(`You can't create a ticket for a frozen client`);
|
|
||||||
|
|
||||||
if (!address.client().isActive)
|
if (!address.client().isActive)
|
||||||
throw new UserError(`You can't create a ticket for a inactive client`);
|
throw new UserError(`You can't create a ticket for a inactive client`);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,18 +13,6 @@ describe('ticket new()', () => {
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should throw an error when the client is frozen', async() => {
|
|
||||||
let error;
|
|
||||||
let params = {addressFk: 125};
|
|
||||||
|
|
||||||
await app.models.Ticket.new(ctx, params)
|
|
||||||
.catch(e => {
|
|
||||||
error = e;
|
|
||||||
});
|
|
||||||
|
|
||||||
expect(error).toEqual(new UserError(`You can't create a ticket for a frozen client`));
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should throw an error if the client isnt frozen and isnt active', async() => {
|
it('should throw an error if the client isnt frozen and isnt active', async() => {
|
||||||
let error;
|
let error;
|
||||||
let params = {addressFk: 6};
|
let params = {addressFk: 6};
|
||||||
|
|
Loading…
Reference in New Issue