salix/modules/worker/front/descriptor-popover/index.spec.js

30 lines
817 B
JavaScript
Raw Normal View History

import './index.js';
2020-04-25 09:50:04 +00:00
describe('vnWorkerDescriptorPopover', () => {
let controller;
2020-04-25 09:50:04 +00:00
let $httpBackend;
beforeEach(ngModule('worker'));
2020-04-25 09:50:04 +00:00
beforeEach(inject(($componentController, _$httpBackend_) => {
$httpBackend = _$httpBackend_;
2020-04-25 09:50:04 +00:00
controller = $componentController('vnWorkerDescriptorPopover', {
$element: null,
$transclude: null
});
2020-04-25 09:50:04 +00:00
}));
describe('loadData()', () => {
it(`should perform a get query to store the worker data into the controller`, () => {
2020-04-25 09:50:04 +00:00
const id = 1;
const response = 'foo';
2020-04-25 09:50:04 +00:00
$httpBackend.expectGET(`Workers/${id}`).respond(response);
controller.id = id;
$httpBackend.flush();
expect(controller.worker).toEqual(response);
});
});
});