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

38 lines
1.2 KiB
JavaScript
Raw Normal View History

2018-09-19 13:05:07 +00:00
import './index.js';
2019-01-21 10:45:53 +00:00
xdescribe('Agency', () => {
2018-09-21 10:35:54 +00:00
describe('Component vnZoneCard', () => {
2018-09-19 13:05:07 +00:00
let $scope;
let controller;
let $httpBackend;
2018-09-21 10:35:54 +00:00
let $stateParams;
2018-09-19 13:05:07 +00:00
beforeEach(ngModule('agency'));
2018-09-19 13:05:07 +00:00
beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => {
2018-09-19 13:05:07 +00:00
$httpBackend = _$httpBackend_;
$scope = $rootScope.$new();
2018-09-21 10:35:54 +00:00
$stateParams = {id: 1};
controller = $componentController('vnZoneCard', {$scope, $stateParams});
2018-09-19 13:05:07 +00:00
}));
2018-09-21 10:35:54 +00:00
describe('getCard()', () => {
it(`should make a query and define zone property`, () => {
let filter = {
include: [
{relation: 'warehouse', fields: ['name']},
{relation: 'agencyMode', fields: ['name']}
]
};
let json = encodeURIComponent(JSON.stringify(filter));
2018-09-25 06:53:57 +00:00
$httpBackend.expectGET(`/agency/api/Zones/1?filter=${json}`).respond({id: 1});
2018-09-21 10:35:54 +00:00
controller.getCard();
2018-09-19 13:05:07 +00:00
$httpBackend.flush();
2018-09-21 10:35:54 +00:00
expect(controller.zone).toEqual({id: 1});
2018-09-19 13:05:07 +00:00
});
});
});
});