Updated unit test
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Joan Sanchez 2020-11-04 14:35:27 +01:00
parent 2a0d2f4394
commit b65f48f0d9
1 changed files with 0 additions and 40 deletions

View File

@ -16,46 +16,6 @@ describe('Item', () => {
controller = $componentController('vnItemTags', {$element, $scope});
}));
describe('itemTags setter', () => {
it('should call getSourceTable one time for each element in the value array', () => {
jest.spyOn(controller, 'getSourceTable');
let itemTags = [
{id: 1},
{id: 2},
{id: 3},
{id: 4}
];
controller.itemTags = itemTags;
expect(controller.getSourceTable.mock.calls.length).toEqual(4);
expect(controller.itemTags).toEqual(itemTags);
});
});
describe('getSourceTable', () => {
it('should return null when the property isFree equals true', () => {
let tag = {id: 1};
controller.getSourceTable(tag);
expect(controller.sourceTables[1].url).toBe(null);
});
it('should return the route of the model in loopback with the first char of the string uppercase and adding a s', () => {
let tag = {id: 1, tag: {sourceTable: 'ink'}};
controller.getSourceTable(tag);
expect(controller.sourceTables[1].url).toBe('Inks');
});
it('should return the route filteritemtags with the id of the selection', () => {
let tag = {id: 1, tag: {id: 3, sourceTable: null, isFree: false}};
controller.getSourceTable(tag);
expect(controller.sourceTables[1].url).toBe('ItemTags/filterItemTags/3');
});
});
describe('getHighestPriority', () => {
it('should return the highest priority value + 1 from the array', () => {
let result = controller.getHighestPriority();