itemBotanical fixed with test
This commit is contained in:
parent
8d5b329839
commit
d69954bb36
|
@ -5,7 +5,7 @@ class ItemBotanical {
|
||||||
this.$http = $http;
|
this.$http = $http;
|
||||||
this.$state = $state;
|
this.$state = $state;
|
||||||
}
|
}
|
||||||
$onInit() {
|
_getBotanical() {
|
||||||
let filter = {
|
let filter = {
|
||||||
where: {itemFk: this.$state.params.id},
|
where: {itemFk: this.$state.params.id},
|
||||||
include: [{relation: 'genus'}, {relation: 'specie'}]
|
include: [{relation: 'genus'}, {relation: 'specie'}]
|
||||||
|
@ -24,6 +24,9 @@ class ItemBotanical {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
$onInit() {
|
||||||
|
this._getBotanical();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ItemBotanical.$inject = ['$http', '$state'];
|
ItemBotanical.$inject = ['$http', '$state'];
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
import './item-botanical.js';
|
||||||
|
|
||||||
|
describe('ItemBotanical', () => {
|
||||||
|
describe('Component vnItemBotanical', () => {
|
||||||
|
let $componentController;
|
||||||
|
let $httpBackend;
|
||||||
|
let $state;
|
||||||
|
let controller;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
angular.mock.module('item');
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(angular.mock.inject((_$componentController_, _$state_, _$httpBackend_) => {
|
||||||
|
$componentController = _$componentController_;
|
||||||
|
$httpBackend = _$httpBackend_;
|
||||||
|
$state = {
|
||||||
|
params: {
|
||||||
|
id: 123
|
||||||
|
}
|
||||||
|
};
|
||||||
|
controller = $componentController('vnItemBotanical', {$state: $state});
|
||||||
|
}));
|
||||||
|
|
||||||
|
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();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue