Merge branch 'dev' of http://git.verdnatura.es/salix into dev
This commit is contained in:
commit
c91163f7d1
|
@ -41,35 +41,39 @@ describe('Ticket', () => {
|
|||
|
||||
describe('shipped() setter', () => {
|
||||
it('should set shipped property and call onChangeShipped() method ', () => {
|
||||
let shipped = new Date();
|
||||
spyOn(controller, 'onChangeShipped');
|
||||
controller.ticket = {id: 1};
|
||||
controller.shipped = new Date();
|
||||
controller.shipped = shipped;
|
||||
|
||||
expect(controller.onChangeShipped).toHaveBeenCalledWith(new Date());
|
||||
expect(controller.onChangeShipped).toHaveBeenCalledWith(shipped);
|
||||
});
|
||||
});
|
||||
|
||||
describe('landed() setter', () => {
|
||||
it('should set landed property and call onChangeLanded() method ', () => {
|
||||
let landed = new Date();
|
||||
spyOn(controller, 'onChangeLanded');
|
||||
controller.ticket = {id: 1};
|
||||
controller.landed = new Date();
|
||||
controller.landed = landed;
|
||||
|
||||
expect(controller.onChangeLanded).toHaveBeenCalledWith(new Date());
|
||||
expect(controller.onChangeLanded).toHaveBeenCalledWith(landed);
|
||||
});
|
||||
});
|
||||
|
||||
describe('onChangeShipped()', () => {
|
||||
it('should return an available landing date', async () => {
|
||||
let shipped = new Date();
|
||||
|
||||
controller._ticket = {
|
||||
id: 1,
|
||||
shipped: new Date(),
|
||||
shipped: shipped,
|
||||
addressFk: 121,
|
||||
agencyModeFk: 2,
|
||||
warehouseFk: 1
|
||||
};
|
||||
let data = {
|
||||
shipped: toJsonDate(new Date()),
|
||||
shipped: toJsonDate(shipped),
|
||||
addressFk: 121,
|
||||
agencyModeFk: 2,
|
||||
warehouseFk: 1
|
||||
|
@ -77,19 +81,20 @@ describe('Ticket', () => {
|
|||
|
||||
$httpBackend.whenPOST(`/api/Tickets/getLanded`, data).respond(200);
|
||||
$httpBackend.expectPOST(`/api/Tickets/getLanded`, data);
|
||||
controller.onChangeShipped(new Date());
|
||||
controller.onChangeShipped(shipped);
|
||||
$httpBackend.flush();
|
||||
});
|
||||
});
|
||||
|
||||
describe('onChangeLanded()', () => {
|
||||
it('should return an available shipment date', async () => {
|
||||
controller._ticket = {id: 1, landed: new Date(), addressFk: 121, agencyModeFk: 2};
|
||||
let data = {landed: new Date(), addressFk: 121, agencyModeFk: 2};
|
||||
let landed = new Date();
|
||||
controller._ticket = {id: 1, landed: landed, addressFk: 121, agencyModeFk: 2};
|
||||
let data = {landed: landed, addressFk: 121, agencyModeFk: 2};
|
||||
|
||||
$httpBackend.whenPOST(`/api/Tickets/getShipped`, data).respond(200);
|
||||
$httpBackend.expectPOST(`/api/Tickets/getShipped`, data);
|
||||
controller.onChangeLanded(new Date());
|
||||
controller.onChangeLanded(landed);
|
||||
$httpBackend.flush();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue