salix/modules/shelving/front/card/index.spec.js

27 lines
724 B
JavaScript
Raw Permalink Normal View History

2022-07-20 11:41:33 +00:00
import './index';
describe('component vnShelvingCard', () => {
let controller;
let $httpBackend;
const data = {id: 1, code: 'AAA'};
beforeEach(ngModule('shelving'));
beforeEach(inject(($componentController, _$httpBackend_, $stateParams) => {
$httpBackend = _$httpBackend_;
let $element = angular.element('<div></div>');
controller = $componentController('vnShelvingCard', {$element});
$stateParams.id = data.id;
$httpBackend.whenRoute('GET', 'Shelvings/:id').respond(data);
}));
it('should reload the controller data', () => {
controller.reload();
$httpBackend.flush();
expect(controller.shelving).toEqual(data);
});
});