@@ -26,7 +26,11 @@ import {
|
||||
|
||||
import { fireEvent } from '@testing-library/react';
|
||||
import { msw, renderInTestApp } from '@backstage/test-utils';
|
||||
import { GithubDeploymentsApiClient, githubDeploymentsApiRef } from '../api';
|
||||
import {
|
||||
GithubDeployment,
|
||||
GithubDeploymentsApiClient,
|
||||
githubDeploymentsApiRef,
|
||||
} from '../api';
|
||||
import { githubDeploymentsPlugin } from '../plugin';
|
||||
import { GithubDeploymentsCard } from './GithubDeploymentsCard';
|
||||
|
||||
@@ -40,6 +44,7 @@ import {
|
||||
import { setupServer } from 'msw/node';
|
||||
import { graphql } from 'msw';
|
||||
import { GithubDeploymentsTable } from './GithubDeploymentsTable';
|
||||
import { Box } from '@material-ui/core';
|
||||
|
||||
jest.mock('@backstage/plugin-catalog-react', () => ({
|
||||
useEntity: () => {
|
||||
@@ -173,12 +178,16 @@ describe('github-deployments', () => {
|
||||
return parsedPayload?.target || 'unknown';
|
||||
};
|
||||
|
||||
const extraColumn = {
|
||||
title: 'Target',
|
||||
render: (row: GithubDeployment): JSX.Element => (
|
||||
<Box>{renderTargetFromPayload(row.payload)}</Box>
|
||||
),
|
||||
};
|
||||
|
||||
const columns = [
|
||||
...GithubDeploymentsTable.defaultDeploymentColumns,
|
||||
GithubDeploymentsTable.columns.createPayloadColumn(
|
||||
'Target',
|
||||
renderTargetFromPayload,
|
||||
),
|
||||
extraColumn,
|
||||
];
|
||||
|
||||
const rendered = await renderInTestApp(
|
||||
|
||||
@@ -88,13 +88,3 @@ export function createLastUpdatedColumn(): TableColumn<GithubDeployment> {
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
export function createCustomColumn(
|
||||
title: string,
|
||||
render: (payload: GithubDeployment) => JSX.Element,
|
||||
): TableColumn<GithubDeployment> {
|
||||
return {
|
||||
title: title,
|
||||
render: (deployment: GithubDeployment) => render(deployment),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user