mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-31 20:51:26 +00:00
fix: Make column name a selection box only for tableRowInsertedCountToBeBetween test (#10527)
This commit is contained in:
parent
0a2f7ec599
commit
203d41c88e
@ -14,6 +14,7 @@
|
||||
import { act, render, screen } from '@testing-library/react';
|
||||
import { TestDefinition } from 'generated/tests/testDefinition';
|
||||
import {
|
||||
MOCK_TABLE_COLUMN_NAME_TO_EXIST,
|
||||
MOCK_TABLE_ROW_INSERTED_COUNT_TO_BE_BETWEEN,
|
||||
MOCK_TABLE_WITH_DATE_TIME_COLUMNS,
|
||||
} from 'mocks/TestSuite.mock';
|
||||
@ -32,7 +33,7 @@ describe('ParameterForm component test', () => {
|
||||
/>
|
||||
);
|
||||
});
|
||||
|
||||
// test definition should be "tableRowInsertedCountToBeBetween"
|
||||
const selectBox = await screen.findByRole('combobox');
|
||||
const parameters = await screen.findAllByTestId('parameter');
|
||||
|
||||
@ -61,4 +62,23 @@ describe('ParameterForm component test', () => {
|
||||
MOCK_TABLE_ROW_INSERTED_COUNT_TO_BE_BETWEEN.parameterDefinition.length
|
||||
);
|
||||
});
|
||||
|
||||
it('Select box should not render if "columnName" field is present but test definition is not "tableRowInsertedCountToBeBetween"', async () => {
|
||||
await act(async () => {
|
||||
render(
|
||||
<ParameterForm
|
||||
definition={MOCK_TABLE_COLUMN_NAME_TO_EXIST as TestDefinition}
|
||||
table={MOCK_TABLE_WITH_DATE_TIME_COLUMNS}
|
||||
/>
|
||||
);
|
||||
});
|
||||
|
||||
const selectBox = screen.queryByRole('combobox');
|
||||
const parameters = await screen.findAllByTestId('parameter');
|
||||
|
||||
expect(selectBox).not.toBeInTheDocument();
|
||||
expect(parameters).toHaveLength(
|
||||
MOCK_TABLE_COLUMN_NAME_TO_EXIST.parameterDefinition.length
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@ -39,7 +39,11 @@ const ParameterForm: React.FC<ParameterFormProps> = ({ definition, table }) => {
|
||||
);
|
||||
switch (data.dataType) {
|
||||
case TestDataType.String:
|
||||
if (data.name === 'columnName' && !isUndefined(table)) {
|
||||
if (
|
||||
!isUndefined(table) &&
|
||||
definition.name === 'tableRowInsertedCountToBeBetween' &&
|
||||
data.name === 'columnName'
|
||||
) {
|
||||
const partitionColumnOptions = table.columns.reduce(
|
||||
(result, column) => {
|
||||
if (SUPPORTED_PARTITION_TYPE.includes(column.dataType)) {
|
||||
|
@ -738,3 +738,29 @@ export const MOCK_TABLE_ROW_INSERTED_COUNT_TO_BE_BETWEEN = {
|
||||
href: 'http://sandbox-beta.open-metadata.org/api/v1/testDefinition/756c7770-0af3-49a9-9905-75a2886e5eec',
|
||||
deleted: false,
|
||||
};
|
||||
|
||||
export const MOCK_TABLE_COLUMN_NAME_TO_EXIST = {
|
||||
id: '6d4e4673-fd7f-4b37-811e-7645c3c17e93',
|
||||
name: 'tableColumnNameToExist',
|
||||
displayName: 'Table Column Name To Exist',
|
||||
fullyQualifiedName: 'tableColumnNameToExist',
|
||||
description:
|
||||
'This test defines the test TableColumnNameToExist. Test the table columns exists in the table.',
|
||||
entityType: 'TABLE',
|
||||
testPlatforms: ['OpenMetadata'],
|
||||
supportedDataTypes: [],
|
||||
parameterDefinition: [
|
||||
{
|
||||
name: 'columnName',
|
||||
displayName: 'Column Name',
|
||||
dataType: 'STRING',
|
||||
description: 'Expected column of the table to exist',
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
version: 0.1,
|
||||
updatedAt: 1672236872076,
|
||||
updatedBy: 'admin',
|
||||
href: 'http://sandbox-beta.open-metadata.org/api/v1/testDefinition/6d4e4673-fd7f-4b37-811e-7645c3c17e93',
|
||||
deleted: false,
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user