#501 unitarios getTags karma
This commit is contained in:
parent
68a3a47894
commit
5e0342c9b9
|
@ -23,6 +23,31 @@ describe('Item', () => {
|
|||
controller = $componentController('vnItemCard', {$state: $state});
|
||||
}));
|
||||
|
||||
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: 'data'});
|
||||
$httpBackend.expectGET('/item/api/ItemTags?filter={"where":{"itemFk":123},"order":"priority ASC","include":{"relation":"tag"}}');
|
||||
controller._getItemTags();
|
||||
$httpBackend.flush();
|
||||
});
|
||||
});
|
||||
|
||||
describe('_getTags()', () => {
|
||||
it('should request to get the Tags and store them in the controller using id as keys', () => {
|
||||
let response = [{id: 5, name: "Diámetro", isFree: true, sourceTable: null, unit: "mm"}];
|
||||
let result = {5: {id: 5, name: "Diámetro", isFree: true, sourceTable: null, unit: "mm"}};
|
||||
|
||||
expect(controller.tags).toEqual({});
|
||||
|
||||
$httpBackend.whenGET('/item/api/Tags').respond(response);
|
||||
$httpBackend.expectGET('/item/api/Tags');
|
||||
controller._getTags();
|
||||
$httpBackend.flush();
|
||||
|
||||
expect(controller.tags).toEqual(result);
|
||||
});
|
||||
});
|
||||
|
||||
describe('_getItem()', () => {
|
||||
it('should request to get the item', () => {
|
||||
$httpBackend.whenGET('/item/api/Items/123?filter={"include":[{"relation":"itemType","scope":{"fields":["name","workerFk","warehouseFk"],"include":{"relation":"worker","fields":["firstName","name"]}}},{"relation":"origin"},{"relation":"ink"},{"relation":"producer"},{"relation":"intrastat"},{"relation":"expence"}]}').respond({data: 'item'});
|
||||
|
@ -31,14 +56,5 @@ describe('Item', () => {
|
|||
$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();
|
||||
$httpBackend.flush();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue