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: 'Delete ticket', callback: this.showDeleteTicketDialog},
{name: 'Change shipped hour', callback: this.showChangeShipped},
{name: 'SMS: Pending payment', callback: this.sendPaymentSms},
{name: 'SMS: Minimum import', callback: this.sendImportSms},
{name: 'SMS Pending payment', callback: this.sendPaymentSms},
{name: 'SMS Minimum import', callback: this.sendImportSms},
{
name: 'Add stowaway',
callback: this.showAddStowaway,

View File

@ -20,7 +20,13 @@ describe('Ticket Component vnTicketDescriptor', () => {
$httpBackend = _$httpBackend_;
$httpParamSerializer = _$httpParamSerializer_;
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 = ()=> {
return true;
};
@ -161,7 +167,6 @@ describe('Ticket Component vnTicketDescriptor', () => {
});
});
describe('showAddStowaway()', () => {
it('should show a dialog with a list of tickets available for an stowaway', () => {
controller.$.addStowaway = {};
@ -223,4 +228,20 @@ describe('Ticket Component vnTicketDescriptor', () => {
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
Recalculate components: Recalcular componentes
Are you sure you want to recalculate the components?: ¿Seguro que quieres recalcular los componentes?
SMS: Minimum import: 'SMS: Importe minimo'
SMS: Pending payment: 'SMS: Pago pendiente'
SMS Minimum import: 'SMS Importe minimo'
SMS Pending payment: 'SMS Pago pendiente'