27 lines
724 B
JavaScript
27 lines
724 B
JavaScript
|
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);
|
||
|
});
|
||
|
});
|