Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added partial success tag #18027

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright 2024 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 '@testing-library/jest-dom';
import { render, screen } from '@testing-library/react';
import React from 'react';
import { STATUS_LABEL } from '../../../constants/constants';
import { Status } from '../../../generated/entity/applications/appRunRecord';
import StatusBadge from './StatusBadge.component';
import { StatusBadgeProps, StatusType } from './StatusBadge.interface';

describe('Test StatusBadge Component', () => {
const defaultProps: StatusBadgeProps = {
dataTestId: 'pipeline-status',
label: STATUS_LABEL[Status.PartialSuccess],
status: StatusType.PartialSuccess,
};

it('renders the correct label', () => {
render(<StatusBadge {...defaultProps} />);

// Check if the label text "Partial Success" is rendered
expect(
screen.getByText(STATUS_LABEL[Status.PartialSuccess])
).toBeInTheDocument();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export enum StatusType {
Running = 'running',
Started = 'started',
Stopped = 'stopped',
PartialSuccess = 'partialSuccess',
}

export interface StatusBadgeProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,9 @@
background-color: @grey-2;
border: 1px solid @grey-3;
}
&.partialSuccess {
color: @partial-success-1;
background-color: @partial-success-2;
border-color: @partial-success-1;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -608,4 +608,5 @@ export const STATUS_LABEL = {
[Status.Started]: 'Started',
[Status.Stopped]: 'Stopped',
[Status.Success]: 'Success',
[Status.PartialSuccess]: 'Partial Success',
};
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@
*/

import { upperFirst } from 'lodash';
import { getEntityStatsData } from './ApplicationUtils';
import { StatusType } from '../components/common/StatusBadge/StatusBadge.interface';
import { Status } from '../generated/entity/applications/appRunRecord';
import {
getEntityStatsData,
getStatusTypeForApplication,
} from './ApplicationUtils';
import {
MOCK_APPLICATION_ENTITY_STATS,
MOCK_APPLICATION_ENTITY_STATS_DATA,
Expand All @@ -30,3 +35,11 @@ describe('ApplicationUtils tests', () => {
);
});
});

describe('getStatusTypeForApplication tests', () => {
it('should return PartialSuccess for PartialSuccess status', () => {
expect(getStatusTypeForApplication(Status.PartialSuccess)).toBe(
StatusType.PartialSuccess
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ export const getStatusTypeForApplication = (status: Status) => {
case Status.Started:
return StatusType.Started;

case Status.PartialSuccess:
return StatusType.PartialSuccess;

default:
return StatusType.Stopped;
}
Expand Down
Loading