diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/TasksPage/shared/ClosedTask.test.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/TasksPage/shared/ClosedTask.test.tsx
new file mode 100644
index 00000000000..7b6e7dc3019
--- /dev/null
+++ b/openmetadata-ui/src/main/resources/ui/src/pages/TasksPage/shared/ClosedTask.test.tsx
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2021 Collate
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { render, screen } from '@testing-library/react';
+import React from 'react';
+import { Thread } from '../../../generated/entity/feed/thread';
+import ClosedTask from './ClosedTask';
+
+const mockTask = {
+ id: 19,
+ type: 'RequestDescription',
+ assignees: [
+ {
+ id: '5a5b7951-60ca-4063-afb5-a0e51538ab71',
+ type: 'user',
+ name: 'marisa',
+ fullyQualifiedName: 'marisa',
+ displayName: 'Marisa Smith',
+ deleted: false,
+ },
+ {
+ id: '82b61b9a-1485-4069-a850-3c862139307e',
+ type: 'user',
+ name: 'sachin.c',
+ fullyQualifiedName: 'sachin.c',
+ displayName: 'Sachin Chaurasiya',
+ deleted: false,
+ },
+ ],
+ status: 'Closed',
+ closedBy: 'sachin.c',
+ closedAt: 1657351363635,
+ oldValue: '',
+ suggestion: 'Can you suggest a description?',
+ newValue: '**Column for storing product data.**',
+} as Thread['task'];
+
+jest.mock('../../../components/common/PopOverCard/UserPopOverCard', () =>
+ jest.fn().mockImplementation(({ children }) => {
+ return
{children}
;
+ })
+);
+
+jest.mock('../../../utils/TimeUtils', () => ({
+ getDayTimeByTimeStamp: jest.fn().mockReturnValue('07 / 09 / 2022'),
+}));
+
+describe('Test ClosedTask Component', () => {
+ it('Should render component', async () => {
+ render();
+
+ const container = await screen.findByTestId('task-closed');
+
+ const userCardPopover = await screen.findByTestId('userPopOverCard');
+
+ const closedBy = await screen.findByTestId('task-closedby');
+
+ const closedAt = await screen.findByTestId('task-closedAt');
+
+ expect(container).toBeInTheDocument();
+ expect(userCardPopover).toBeInTheDocument();
+ expect(closedBy).toBeInTheDocument();
+ expect(closedAt).toBeInTheDocument();
+
+ expect(closedBy).toHaveTextContent(mockTask?.closedBy || '');
+ expect(closedAt).toHaveTextContent('07 / 09 / 2022');
+ });
+});
diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/TasksPage/shared/ClosedTask.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/TasksPage/shared/ClosedTask.tsx
index d05fa3f9c35..19866c7c987 100644
--- a/openmetadata-ui/src/main/resources/ui/src/pages/TasksPage/shared/ClosedTask.tsx
+++ b/openmetadata-ui/src/main/resources/ui/src/pages/TasksPage/shared/ClosedTask.tsx
@@ -33,13 +33,15 @@ const ClosedTask: FC = ({ task }) => {
name={task?.closedBy || ''}
width="20"
/>
-
+
{task?.closedBy}
{' '}
closed this task
-
+
{toLower(getDayTimeByTimeStamp(task?.closedAt as number))}
diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/TasksPage/shared/ColumnDetail.test.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/TasksPage/shared/ColumnDetail.test.tsx
new file mode 100644
index 00000000000..152ecde7b21
--- /dev/null
+++ b/openmetadata-ui/src/main/resources/ui/src/pages/TasksPage/shared/ColumnDetail.test.tsx
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2021 Collate
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { render, screen } from '@testing-library/react';
+import React from 'react';
+import { Column } from '../../../generated/entity/data/table';
+import ColumnDetail from './ColumnDetail';
+
+const mockColumnData = {
+ name: 'products',
+ dataType: 'ARRAY',
+ arrayDataType: 'STRUCT',
+ dataLength: 1,
+ dataTypeDisplay:
+ 'array>',
+ description: '**Column for storing product data.**',
+ fullyQualifiedName:
+ 'sample_data.ecommerce_db.shopify.raw_product_catalog.products',
+ tags: [
+ {
+ tagFQN: 'PersonalData.Personal',
+ description:
+ 'Data that can be used to directly or indirectly identify a person.',
+ source: 'Tag',
+ labelType: 'Manual',
+ state: 'Confirmed',
+ },
+ ],
+ constraint: 'NULL',
+ ordinalPosition: 2,
+} as Column;
+
+jest.mock('../../../components/common/Ellipses/Ellipses', () =>
+ jest.fn().mockImplementation(({ children }) => {
+ return {children}
;
+ })
+);
+
+describe('Test column detail component', () => {
+ it('Should render the component', async () => {
+ render();
+
+ const container = await screen.findByTestId('column-details');
+
+ const columnType = await screen.findByTestId('column-type');
+
+ const columnTags = await screen.findByTestId('column-tags');
+
+ expect(container).toBeInTheDocument();
+ expect(columnType).toBeInTheDocument();
+ expect(columnTags).toBeInTheDocument();
+ });
+
+ it('Should not render the component if column is empty object', async () => {
+ render();
+
+ const container = screen.queryByTestId('column-details');
+
+ const columnType = screen.queryByTestId('column-type');
+
+ const columnTags = screen.queryByTestId('column-tags');
+
+ expect(container).not.toBeInTheDocument();
+ expect(columnType).not.toBeInTheDocument();
+ expect(columnTags).not.toBeInTheDocument();
+ });
+});
diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/TasksPage/shared/ColumnDetail.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/TasksPage/shared/ColumnDetail.tsx
index ad0753bdd8e..dd6f541123a 100644
--- a/openmetadata-ui/src/main/resources/ui/src/pages/TasksPage/shared/ColumnDetail.tsx
+++ b/openmetadata-ui/src/main/resources/ui/src/pages/TasksPage/shared/ColumnDetail.tsx
@@ -21,7 +21,9 @@ const ColumnDetail = ({ column }: { column: Column }) => {
return !isEmpty(column) && !isUndefined(column) ? (
-
+
Column type:
{' '}
@@ -29,7 +31,7 @@ const ColumnDetail = ({ column }: { column: Column }) => {
{column.tags && column.tags.length ? (
-
+
,
+};
+
+describe('Test TaskPageLayout Component', () => {
+ it('Should render the component', async () => {
+ render(
);
+
+ const leftSider = await screen.findByTestId('left-sider');
+ const rightSider = await screen.findByTestId('right-sider');
+
+ const children = await screen.findByTestId('children');
+
+ expect(leftSider).toBeInTheDocument();
+ expect(rightSider).toBeInTheDocument();
+ expect(children).toBeInTheDocument();
+ });
+});
diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/TasksPage/shared/TaskPageLayout.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/TasksPage/shared/TaskPageLayout.tsx
index d2d8c3bd67e..f0a81e72bb3 100644
--- a/openmetadata-ui/src/main/resources/ui/src/pages/TasksPage/shared/TaskPageLayout.tsx
+++ b/openmetadata-ui/src/main/resources/ui/src/pages/TasksPage/shared/TaskPageLayout.tsx
@@ -23,9 +23,9 @@ const TaskPageLayout: FC
= ({ children }) => {
return (
-
+
{children}
-
+
);
};
diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/TasksPage/shared/TaskStatus.test.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/TasksPage/shared/TaskStatus.test.tsx
new file mode 100644
index 00000000000..e7f3223fae4
--- /dev/null
+++ b/openmetadata-ui/src/main/resources/ui/src/pages/TasksPage/shared/TaskStatus.test.tsx
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2021 Collate
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { render, screen } from '@testing-library/react';
+import React from 'react';
+import { ThreadTaskStatus } from '../../../generated/entity/feed/thread';
+import TaskStatus from './TaskStatus';
+
+const mockProps = {
+ status: ThreadTaskStatus.Open,
+};
+
+describe('Test Task Status Component', () => {
+ it('Should render the component', async () => {
+ render();
+
+ const taskStatus = await screen.findByTestId('task-status');
+
+ const taskStatusBadge = await screen.findByTestId('task-status-badge');
+ const taskStatusText = await screen.findByTestId('task-status-text');
+
+ expect(taskStatus).toBeInTheDocument();
+ expect(taskStatusBadge).toBeInTheDocument();
+ expect(taskStatusText).toBeInTheDocument();
+ });
+
+ it('Should have relavent class name for open status', async () => {
+ render();
+
+ const taskStatus = await screen.findByTestId('task-status');
+
+ const taskStatusBadge = await screen.findByTestId('task-status-badge');
+ const taskStatusText = await screen.findByTestId('task-status-text');
+
+ expect(taskStatus).toHaveClass('tw-bg-task-status-bg');
+
+ expect(taskStatusBadge).toHaveClass('tw-bg-task-status-fg');
+
+ expect(taskStatusText).toHaveClass('tw-text-task-status-fg');
+ });
+
+ it('Should have relavent class name for closed status', async () => {
+ render();
+
+ const taskStatus = await screen.findByTestId('task-status');
+
+ const taskStatusBadge = await screen.findByTestId('task-status-badge');
+ const taskStatusText = await screen.findByTestId('task-status-text');
+
+ expect(taskStatus).toHaveClass('tw-bg-gray-100');
+
+ expect(taskStatusBadge).toHaveClass('tw-bg-gray-500');
+
+ expect(taskStatusText).toHaveClass('tw-text-gray-500');
+ });
+});
diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/TasksPage/shared/TaskStatus.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/TasksPage/shared/TaskStatus.tsx
index 910f1f165dd..abc0a89f53c 100644
--- a/openmetadata-ui/src/main/resources/ui/src/pages/TasksPage/shared/TaskStatus.tsx
+++ b/openmetadata-ui/src/main/resources/ui/src/pages/TasksPage/shared/TaskStatus.tsx
@@ -12,45 +12,45 @@
*/
import classNames from 'classnames';
-import { isEqual } from 'lodash';
-import React, { Fragment } from 'react';
+import React from 'react';
import { ThreadTaskStatus } from '../../../generated/entity/feed/thread';
const TaskStatus = ({ status }: { status: ThreadTaskStatus }) => {
- const openCheck = isEqual(status, ThreadTaskStatus.Open);
- const closedCheck = isEqual(status, ThreadTaskStatus.Closed);
+ const openCheck = status === ThreadTaskStatus.Open;
+ const closedCheck = status === ThreadTaskStatus.Closed;
return (
-
-
+
-
-
- {status}
-
-
-
+ {
+ 'tw-bg-gray-500': closedCheck,
+ }
+ )}
+ data-testid="task-status-badge"
+ />
+
+ {status}
+
+
);
};