salix/modules/worker/front/department/descriptor/index.spec.js

27 lines
794 B
JavaScript
Raw Normal View History

2023-06-01 14:03:55 +00:00
import './index.js';
describe('vnWorkerDepartmentDescriptor', () => {
let controller;
let $httpBackend;
beforeEach(ngModule('worker'));
beforeEach(inject(($componentController, _$httpBackend_) => {
$httpBackend = _$httpBackend_;
controller = $componentController('vnWorkerDepartmentDescriptor', {$element: null});
}));
describe('loadData()', () => {
it(`should perform a get query to store the department data into the controller`, () => {
const id = '31';
const response = 'foo';
$httpBackend.expectRoute('GET', `Departments/${id}`).respond(response);
controller.id = id;
$httpBackend.flush();
expect(controller.department).toEqual(response);
});
});
});