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

27 lines
759 B
JavaScript
Raw Permalink Normal View History

import './index.js';
describe('vnWorkerDescriptor', () => {
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_;
controller = $componentController('vnWorkerDescriptor', {$element: 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';
$httpBackend.expectRoute('GET', `Workers/${id}`).respond(response);
2020-04-25 09:50:04 +00:00
controller.id = id;
$httpBackend.flush();
expect(controller.worker).toEqual(response);
});
});
});