#1211 client.billingData
gitea/salix/dev This commit looks good Details

This commit is contained in:
Carlos Jimenez Ruiz 2019-03-07 12:11:06 +01:00
parent 75fba75688
commit 6bb4f04bd1
3 changed files with 20 additions and 3 deletions

View File

@ -87,6 +87,7 @@ export default {
newBankEntityButton: 'vn-client-billing-data vn-icon-button[vn-tooltip="New bank entity"] > button', newBankEntityButton: 'vn-client-billing-data vn-icon-button[vn-tooltip="New bank entity"] > button',
newBankEntityName: 'vn-client-billing-data > vn-dialog vn-textfield[label="Name"] input', newBankEntityName: 'vn-client-billing-data > vn-dialog vn-textfield[label="Name"] input',
newBankEntityBIC: 'vn-client-billing-data > vn-dialog vn-textfield[label="Swift / BIC"] input', newBankEntityBIC: 'vn-client-billing-data > vn-dialog vn-textfield[label="Swift / BIC"] input',
newBankEntityCode: 'vn-client-billing-data > vn-dialog vn-textfield[label="Code"] input',
acceptBankEntityButton: 'vn-client-billing-data > vn-dialog button[response="ACCEPT"]', acceptBankEntityButton: 'vn-client-billing-data > vn-dialog button[response="ACCEPT"]',
saveButton: `${components.vnSubmit}` saveButton: `${components.vnSubmit}`
}, },

View File

@ -44,6 +44,7 @@ describe('Client Edit pay method path', () => {
const newcode = await nightmare const newcode = await nightmare
.waitToClick(selectors.clientPayMethod.newBankEntityButton) .waitToClick(selectors.clientPayMethod.newBankEntityButton)
.write(selectors.clientPayMethod.newBankEntityName, 'Gotham City Bank') .write(selectors.clientPayMethod.newBankEntityName, 'Gotham City Bank')
.write(selectors.clientPayMethod.newBankEntityCode, 999)
.write(selectors.clientPayMethod.newBankEntityBIC, 'GTHMCT') .write(selectors.clientPayMethod.newBankEntityBIC, 'GTHMCT')
.waitToClick(selectors.clientPayMethod.acceptBankEntityButton) .waitToClick(selectors.clientPayMethod.acceptBankEntityButton)
.waitToGetProperty(`${selectors.clientPayMethod.swiftBicAutocomplete} input`, 'value'); .waitToGetProperty(`${selectors.clientPayMethod.swiftBicAutocomplete} input`, 'value');

View File

@ -51,7 +51,8 @@ describe('Client', () => {
controller.newBankEntity = { controller.newBankEntity = {
name: '', name: '',
bic: 'ES123', bic: 'ES123',
countryFk: 1 countryFk: 1,
id: 999
}; };
controller.onBankEntityResponse('ACCEPT'); controller.onBankEntityResponse('ACCEPT');
@ -62,18 +63,32 @@ describe('Client', () => {
controller.newBankEntity = { controller.newBankEntity = {
name: 'My new bank entity', name: 'My new bank entity',
bic: '', bic: '',
countryFk: 1 countryFk: 1,
id: 999
}; };
controller.onBankEntityResponse('ACCEPT'); controller.onBankEntityResponse('ACCEPT');
expect(vnApp.showError).toHaveBeenCalledWith(`Swift / BIC can't be empty`); expect(vnApp.showError).toHaveBeenCalledWith(`Swift / BIC can't be empty`);
}); });
it(`should throw an error if id property is empty`, () => {
controller.newBankEntity = {
name: 'My new bank entity',
bic: 'ES123',
countryFk: 1,
id: null
};
controller.onBankEntityResponse('ACCEPT');
expect(vnApp.showError).toHaveBeenCalledWith(`Code can't be empty`);
});
it('should request to create a new bank entity', () => { it('should request to create a new bank entity', () => {
let newBankEntity = { let newBankEntity = {
name: 'My new bank entity', name: 'My new bank entity',
bic: 'ES123', bic: 'ES123',
countryFk: 1 countryFk: 1,
id: 999
}; };
controller.newBankEntity = newBankEntity; controller.newBankEntity = newBankEntity;
$httpBackend.when('POST', '/client/api/BankEntities').respond('done'); $httpBackend.when('POST', '/client/api/BankEntities').respond('done');