salix/modules/zone/front/card/index.spec.js

27 lines
744 B
JavaScript
Raw Normal View History

2018-09-19 13:05:07 +00:00
import './index.js';
2019-04-26 14:10:51 +00:00
describe('Agency Component vnZoneCard', () => {
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
2019-11-10 10:08:44 +00:00
beforeEach(angular.mock.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
});
});