38 lines
1.2 KiB
JavaScript
38 lines
1.2 KiB
JavaScript
import './index.js';
|
|
|
|
describe('Agency Component vnZoneCard', () => {
|
|
let $scope;
|
|
let controller;
|
|
let $httpBackend;
|
|
let $stateParams;
|
|
|
|
beforeEach(angular.mock.module('agency', $translateProvider => {
|
|
$translateProvider.translations('en', {});
|
|
}));
|
|
|
|
beforeEach(angular.mock.inject(($componentController, $rootScope, _$httpBackend_) => {
|
|
$httpBackend = _$httpBackend_;
|
|
$scope = $rootScope.$new();
|
|
$stateParams = {id: 1};
|
|
controller = $componentController('vnZoneCard', {$scope, $stateParams});
|
|
}));
|
|
|
|
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));
|
|
$httpBackend.expectGET(`/agency/api/Zones/1?filter=${json}`).respond({id: 1});
|
|
controller.getCard();
|
|
$httpBackend.flush();
|
|
|
|
expect(controller.zone).toEqual({id: 1});
|
|
});
|
|
});
|
|
});
|
|
|