remove sorting of tags (#17604)

* remove sorting of tags from ui

* add playwright tests

* add playwright test for tags in children

(cherry picked from commit dfafca8231b948acbd6efffd8b732200e436a574)
This commit is contained in:
Karan Hotchandani 2024-08-28 11:52:31 +05:30 committed by karanh37
parent 8ec2cdc638
commit c4631684d9
5 changed files with 14 additions and 37 deletions

View File

@ -201,7 +201,8 @@ export class EntityClass {
async tag(page: Page, tag1: string, tag2: string) {
await assignTag(page, tag1);
await assignTag(page, tag2, 'Edit');
await removeTag(page, [tag1, tag2]);
await removeTag(page, [tag2]);
await removeTag(page, [tag1]);
await page
.getByTestId('entity-right-panel')
@ -233,7 +234,13 @@ export class EntityClass {
});
await removeTagsFromChildren({
page,
tags: [tag1, tag2],
tags: [tag2],
rowId,
rowSelector,
});
await removeTagsFromChildren({
page,
tags: [tag1],
rowId,
rowSelector,
});

View File

@ -50,7 +50,6 @@ import {
mockTableNameWithSpecialChar4,
mockTableNameWithSpecialChar5,
mockTags,
sortedMockTags,
} from './CommonUtils.mock';
const AXIOS_ERROR_MESSAGE = {
@ -71,21 +70,7 @@ const AXIOS_ERROR_MESSAGE = {
describe('Tests for CommonUtils', () => {
describe('Tests for sortTagsCaseInsensitive function', () => {
it('Input of unsorted array to sortTagsCaseInsensitive should return array of tags sorted by tagFQN', () => {
expect(sortTagsCaseInsensitive(cloneDeep(mockTags))).toEqual(
sortedMockTags
);
});
it('Input of sorted array to sortTagsCaseInsensitive should return array of tags sorted by tagFQN', () => {
expect(sortTagsCaseInsensitive(cloneDeep(sortedMockTags))).toEqual(
sortedMockTags
);
});
it('Array returned by sortTagsCaseInsensitive should not be equal to the unsorted input array of tags', () => {
expect(sortTagsCaseInsensitive(cloneDeep(mockTags))).not.toEqual(
mockTags
);
expect(sortTagsCaseInsensitive(cloneDeep(mockTags))).toEqual(mockTags);
});
it('Function getNameFromFQN should return the correct table name for fqn without special characters', () => {

View File

@ -733,9 +733,7 @@ export const getTrimmedContent = (content: string, limit: number) => {
};
export const sortTagsCaseInsensitive = (tags: TagLabel[]) => {
return tags.sort((tag1, tag2) =>
tag1.tagFQN.toLowerCase() < tag2.tagFQN.toLowerCase() ? -1 : 1
);
return tags;
};
export const Transi18next = ({

View File

@ -13,24 +13,12 @@
import { cloneDeep } from 'lodash';
import { sortTagsForCharts } from './DashboardDetailsUtils';
import { mockCharts, sortedTagsMockCharts } from './DashboardDetailsUtils.mock';
import { mockCharts } from './DashboardDetailsUtils.mock';
describe('Tests for DashboardDetailsUtils', () => {
describe('Tests for sortTagsForCharts function', () => {
it('Input of unsorted array to sortTagsForCharts should return charts array with sorted order of tags by tagsFQN', () => {
expect(sortTagsForCharts(cloneDeep(mockCharts))).toEqual(
sortedTagsMockCharts
);
});
it('Input of sorted array to sortTagsForCharts should return charts array with sorted order of tags by tagsFQN', () => {
expect(sortTagsForCharts(cloneDeep(sortedTagsMockCharts))).toEqual(
sortedTagsMockCharts
);
});
it('The Array returned by sortTagsForCharts should not be eqaul to the unsorted input array', () => {
expect(sortTagsForCharts(cloneDeep(mockCharts))).not.toEqual(mockCharts);
expect(sortTagsForCharts(cloneDeep(mockCharts))).toEqual(mockCharts);
});
});
});

View File

@ -14,7 +14,6 @@
import {
mockPipelineDetails,
mockPipelineDetailsWithoutTaskTags,
mockSortedPipelineDetails,
} from './mocks/PipelineDetailsUtils.mock';
import { getFormattedPipelineDetails } from './PipelineDetailsUtils';
@ -22,7 +21,7 @@ describe('PipelineDetailsUtils test', () => {
it('getFormattedPipelineDetails should return pipeline details with sorted tags for tasks', () => {
const results = getFormattedPipelineDetails(mockPipelineDetails);
expect(results).toEqual(mockSortedPipelineDetails);
expect(results).toEqual(mockPipelineDetails);
});
it('getFormattedPipelineDetails should return pipeline details without any changes in case no tasks are present in it', () => {