Updated unit test
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Joan Sanchez 2020-03-11 08:45:54 +01:00
parent 3736dcf792
commit 581e2fcd1f
3 changed files with 27 additions and 6 deletions

View File

@ -16,8 +16,8 @@ class Controller extends Component {
{name: 'Send Delivery Note', callback: this.confirmDeliveryNote}, {name: 'Send Delivery Note', callback: this.confirmDeliveryNote},
{name: 'Delete ticket', callback: this.showDeleteTicketDialog}, {name: 'Delete ticket', callback: this.showDeleteTicketDialog},
{name: 'Change shipped hour', callback: this.showChangeShipped}, {name: 'Change shipped hour', callback: this.showChangeShipped},
{name: 'SMS: Pending payment', callback: this.sendPaymentSms}, {name: 'SMS Pending payment', callback: this.sendPaymentSms},
{name: 'SMS: Minimum import', callback: this.sendImportSms}, {name: 'SMS Minimum import', callback: this.sendImportSms},
{ {
name: 'Add stowaway', name: 'Add stowaway',
callback: this.showAddStowaway, callback: this.showAddStowaway,

View File

@ -20,7 +20,13 @@ describe('Ticket Component vnTicketDescriptor', () => {
$httpBackend = _$httpBackend_; $httpBackend = _$httpBackend_;
$httpParamSerializer = _$httpParamSerializer_; $httpParamSerializer = _$httpParamSerializer_;
controller = $componentController('vnTicketDescriptor', {$element}); controller = $componentController('vnTicketDescriptor', {$element});
controller._ticket = {id: 2, invoiceOut: {id: 1}, client: {id: 101, email: 'client@email'}}; controller._ticket = {
id: 2,
clientFk: 101,
invoiceOut: {id: 1},
client: {id: 101, email: 'client@email'},
address: {id: 101, mobile: 111111111, phone: 2222222222}
};
controller.cardReload = ()=> { controller.cardReload = ()=> {
return true; return true;
}; };
@ -161,7 +167,6 @@ describe('Ticket Component vnTicketDescriptor', () => {
}); });
}); });
describe('showAddStowaway()', () => { describe('showAddStowaway()', () => {
it('should show a dialog with a list of tickets available for an stowaway', () => { it('should show a dialog with a list of tickets available for an stowaway', () => {
controller.$.addStowaway = {}; controller.$.addStowaway = {};
@ -223,4 +228,20 @@ describe('Ticket Component vnTicketDescriptor', () => {
expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!'); expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Data saved!');
}); });
}); });
describe('showSMSDialog()', () => {
it('should set the destionationFk and destination properties and then call the sms open() method', () => {
controller.$.sms = {open: () => {}};
jest.spyOn(controller.$.sms, 'open');
const clientId = 101;
const expectedPhone = 111111111;
controller.newSMS = {};
controller.showSMSDialog();
expect(controller.newSMS.destinationFk).toEqual(clientId);
expect(controller.newSMS.destination).toEqual(expectedPhone);
expect(controller.$.sms.open).toHaveBeenCalledWith();
});
});
}); });

View File

@ -27,5 +27,5 @@ Shipped hour updated: Hora de envio modificada
Deleted ticket: Ticket eliminado Deleted ticket: Ticket eliminado
Recalculate components: Recalcular componentes Recalculate components: Recalcular componentes
Are you sure you want to recalculate the components?: ¿Seguro que quieres recalcular los componentes? Are you sure you want to recalculate the components?: ¿Seguro que quieres recalcular los componentes?
SMS: Minimum import: 'SMS: Importe minimo' SMS Minimum import: 'SMS Importe minimo'
SMS: Pending payment: 'SMS: Pago pendiente' SMS Pending payment: 'SMS Pago pendiente'