salix/modules/supplier/front/summary/index.spec.js

33 lines
1.0 KiB
JavaScript
Raw Permalink Normal View History

2020-10-20 07:44:44 +00:00
import './index';
describe('Supplier', () => {
describe('Component vnSupplierSummary', () => {
2020-10-20 07:44:44 +00:00
let controller;
let $httpBackend;
let $scope;
beforeEach(ngModule('supplier'));
2020-10-20 07:44:44 +00:00
beforeEach(inject(($componentController, _$httpBackend_, $rootScope) => {
$httpBackend = _$httpBackend_;
$scope = $rootScope.$new();
const $element = angular.element('<vn-supplier-summary></vn-supplier-summary>');
controller = $componentController('vnSupplierSummary', {$element, $scope});
2020-10-20 07:44:44 +00:00
}));
describe('getSummary()', () => {
it('should perform a get asking for the supplier data', () => {
controller.supplier = {id: 1};
2020-10-20 07:44:44 +00:00
const query = `Suppliers/${controller.supplier.id}/getSummary`;
2020-10-20 07:44:44 +00:00
$httpBackend.expectGET(query).respond({id: 1});
controller.getSummary();
2020-10-20 07:44:44 +00:00
$httpBackend.flush();
expect(controller.summary).toEqual({id: 1});
2020-10-20 07:44:44 +00:00
});
});
});
});