33 lines
1.0 KiB
JavaScript
33 lines
1.0 KiB
JavaScript
import './index';
|
|
|
|
describe('Supplier', () => {
|
|
describe('Component vnSupplierSummary', () => {
|
|
let controller;
|
|
let $httpBackend;
|
|
let $scope;
|
|
|
|
beforeEach(ngModule('supplier'));
|
|
|
|
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});
|
|
}));
|
|
|
|
describe('getSummary()', () => {
|
|
it('should perform a get asking for the supplier data', () => {
|
|
controller.supplier = {id: 1};
|
|
|
|
const query = `Suppliers/${controller.supplier.id}/getSummary`;
|
|
|
|
$httpBackend.expectGET(query).respond({id: 1});
|
|
controller.getSummary();
|
|
$httpBackend.flush();
|
|
|
|
expect(controller.summary).toEqual({id: 1});
|
|
});
|
|
});
|
|
});
|
|
});
|