2018-05-25 08:03:45 +00:00
|
|
|
import './index.js';
|
2018-02-05 15:53:41 +00:00
|
|
|
|
|
|
|
describe('Item', () => {
|
|
|
|
describe('Component vnItemCard', () => {
|
|
|
|
let $componentController;
|
|
|
|
let $httpBackend;
|
|
|
|
let $state;
|
|
|
|
let controller;
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
angular.mock.module('item');
|
|
|
|
});
|
|
|
|
|
|
|
|
beforeEach(angular.mock.inject((_$componentController_, _$state_, _$httpBackend_) => {
|
|
|
|
$componentController = _$componentController_;
|
|
|
|
$httpBackend = _$httpBackend_;
|
2018-02-20 13:30:02 +00:00
|
|
|
$state = {
|
|
|
|
params: {
|
|
|
|
id: 123
|
|
|
|
}
|
|
|
|
};
|
2018-02-05 15:53:41 +00:00
|
|
|
controller = $componentController('vnItemCard', {$state: $state});
|
|
|
|
}));
|
|
|
|
|
2018-03-02 09:51:01 +00:00
|
|
|
describe('_getItem()', () => {
|
|
|
|
it('should request to get the item', () => {
|
2018-04-16 15:09:43 +00:00
|
|
|
$httpBackend.whenGET('/item/api/Items/123?filter={"include":[{"relation":"itemType","scope":{"fields":["name","workerFk"],"include":{"relation":"worker","fields":["firstName","name"]}}},{"relation":"origin"},{"relation":"ink"},{"relation":"producer"},{"relation":"intrastat"},{"relation":"expence"}]}').respond({data: 'item'});
|
|
|
|
$httpBackend.expectGET('/item/api/Items/123?filter={"include":[{"relation":"itemType","scope":{"fields":["name","workerFk"],"include":{"relation":"worker","fields":["firstName","name"]}}},{"relation":"origin"},{"relation":"ink"},{"relation":"producer"},{"relation":"intrastat"},{"relation":"expence"}]}');
|
2018-03-02 09:51:01 +00:00
|
|
|
controller._getItem();
|
|
|
|
$httpBackend.flush();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('_getItemTags()', () => {
|
|
|
|
it('should request to get the ItemTags', () => {
|
|
|
|
$httpBackend.whenGET('/item/api/ItemTags?filter={"where":{"itemFk":123},"order":"priority ASC","include":{"relation":"tag"}}').respond({data: 'item'});
|
|
|
|
$httpBackend.expectGET('/item/api/ItemTags?filter={"where":{"itemFk":123},"order":"priority ASC","include":{"relation":"tag"}}');
|
|
|
|
controller._getItemTags();
|
2018-02-05 15:53:41 +00:00
|
|
|
$httpBackend.flush();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|