salix/modules/item/front/botanical/index.spec.js

33 lines
1.2 KiB
JavaScript
Raw Normal View History

import './index.js';
2018-02-21 12:10:23 +00:00
describe('ItemBotanical', () => {
describe('Component vnItemBotanical', () => {
let $httpBackend;
let $state;
let controller;
2019-09-13 14:09:14 +00:00
beforeEach(angular.mock.module('item', $translateProvider => {
$translateProvider.translations('en', {});
}));
2018-02-21 12:10:23 +00:00
beforeEach(angular.mock.inject(($componentController, _$state_, _$httpBackend_) => {
2018-02-21 12:10:23 +00:00
$httpBackend = _$httpBackend_;
$state = {
params: {
id: 123
}
};
controller = $componentController('vnItemBotanical', {$state});
2018-02-21 12:10:23 +00:00
}));
describe('_getBotanical()', () => {
it('should request to patch the propagation of botanical status', () => {
$httpBackend.whenGET('/item/api/ItemBotanicals?filter={"where":{"itemFk":123},"include":[{"relation":"genus"},{"relation":"specie"}]}').respond({data: 'item'});
$httpBackend.expectGET('/item/api/ItemBotanicals?filter={"where":{"itemFk":123},"include":[{"relation":"genus"},{"relation":"specie"}]}');
controller.$onInit();
$httpBackend.flush();
});
});
});
});