salix/modules/ticket/front/component/index.spec.js

91 lines
2.9 KiB
JavaScript
Raw Normal View History

import './index.js';
2018-12-27 11:54:16 +00:00
import crudModel from 'core/mocks/crud-model';
describe('ticket', () => {
describe('Component vnTicketComponents', () => {
let controller;
beforeEach(ngModule('ticket'));
2020-07-23 14:46:16 +00:00
beforeEach(inject(($componentController, $rootScope, $state) => {
$state.params.id = '1';
let $scope = $rootScope.$new();
$scope.model = crudModel;
$scope.model.data = [{
components: [
{
component: {
name: 'valor de compra',
componentType: {
isBase: 1
}
},
value: 5
},
{
component: {
name: 'reparto',
componentType: {
isBase: 0
}
},
value: 5
},
{
component: {
name: 'recobro',
componentType: {
isBase: 0
}
},
value: 5
}
],
quantity: 1
},
{
components: [
{
component: {
name: 'valor de compra',
componentType: {
isBase: 1
}
},
value: 1
},
{
component: {
name: 'reparto',
componentType: {
isBase: 0
}
},
value: 1
},
{
component: {
name: 'recobro',
componentType: {
isBase: 0
}
},
value: 1
},
],
quantity: 5
}];
2020-03-18 07:35:59 +00:00
const $element = angular.element('<vn-ticket-components></vn-ticket-components>');
controller = $componentController('vnTicketComponents', {$element, $scope});
}));
describe('base()', () => {
it(`should return the sum from all componenets base in each sale`, () => {
let result = controller.base();
expect(result).toEqual(10);
});
});
});
});