Skip to content

Commit

Permalink
[AAE-19070] Unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wiktord2000 committed Dec 18, 2023
1 parent 89bf9e7 commit de0fa02
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ import {
mockEuropeCountriesData,
mockCountriesIncorrectData,
mockInvalidSchemaDefinition,
mockSchemaDefinition
mockSchemaDefinition,
mockMultipleTypesData,
mockMultipleTypesSchemaDefinition
} from '../../../mocks/data-table-widget.mock';
import { ObjectDataRow } from '@alfresco/adf-core';

Expand Down Expand Up @@ -64,4 +66,17 @@ describe('WidgetDataTableAdapter', () => {

expect(isValid).toBeTrue();
});

it('should hide specific column types', () => {
widgetDataTableAdapter = new WidgetDataTableAdapter(mockMultipleTypesData, mockMultipleTypesSchemaDefinition);
const columns = widgetDataTableAdapter.getColumns();

expect(columns.length).toBe(4);

columns.forEach(column => {
WidgetDataTableAdapter.hiddenColumnTypes.includes(column.type)
? expect(column.isHidden).toBeTrue()
: expect(column.isHidden).toBeFalse();
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,46 @@ export const mockInvalidSchemaDefinition: DataColumn[] = [
}
];

export const mockMultipleTypesSchemaDefinition: DataColumn[] = [
{
type: 'text',
key: 'text',
title: 'Text column',
sortable: true,
draggable: true
},
{
type: 'location',
key: 'location',
title: 'Location column',
sortable: true,
draggable: true
},
{
type: 'image',
key: 'imageUrl',
title: 'Image column',
sortable: true,
draggable: true
},
{
type: 'fileSize',
key: 'fileSize',
title: 'FileSize column',
sortable: true,
draggable: true
}
];

export const mockMultipleTypesData = [
{
text: 'Example text',
location: '-me-/logo.jpg',
imageUrl: 'https://exmaple.domain.com/logo.jpg',
fileSize: 223400
}
];

export const mockEuropeCountriesData = [
{
id: 'PL',
Expand Down

0 comments on commit de0fa02

Please sign in to comment.