2018-09-19 13:05:07 +00:00
|
|
|
import './index.js';
|
|
|
|
|
2020-02-26 06:02:03 +00:00
|
|
|
describe('Zone Component vnZoneCard', () => {
|
2019-04-26 14:10:51 +00:00
|
|
|
let controller;
|
|
|
|
let $httpBackend;
|
2019-11-10 10:08:44 +00:00
|
|
|
let data = {id: 1, name: 'fooName'};
|
2018-09-19 13:05:07 +00:00
|
|
|
|
2020-02-25 07:08:13 +00:00
|
|
|
beforeEach(ngModule('zone'));
|
2018-09-19 13:05:07 +00:00
|
|
|
|
2020-07-23 14:46:16 +00:00
|
|
|
beforeEach(inject(($componentController, _$httpBackend_, $stateParams) => {
|
2019-04-26 14:10:51 +00:00
|
|
|
$httpBackend = _$httpBackend_;
|
2019-11-10 10:08:44 +00:00
|
|
|
|
|
|
|
let $element = angular.element('<div></div>');
|
|
|
|
controller = $componentController('vnZoneCard', {$element});
|
|
|
|
|
|
|
|
$stateParams.id = data.id;
|
|
|
|
$httpBackend.whenRoute('GET', 'Zones/:id').respond(data);
|
2019-04-26 14:10:51 +00:00
|
|
|
}));
|
2018-09-19 13:05:07 +00:00
|
|
|
|
2019-11-10 10:08:44 +00:00
|
|
|
it('should request data and set it on the controller', () => {
|
|
|
|
controller.reload();
|
|
|
|
$httpBackend.flush();
|
2018-09-19 13:05:07 +00:00
|
|
|
|
2019-11-10 10:08:44 +00:00
|
|
|
expect(controller.zone).toEqual(data);
|
2018-09-19 13:05:07 +00:00
|
|
|
});
|
|
|
|
});
|