test(frontend): Migrate from describe/it to flat test() pattern (#35305)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Evan Rusackas
2025-09-28 11:45:33 -07:00
committed by GitHub
parent ff102aadb3
commit d62249d13f
255 changed files with 2017 additions and 1554 deletions

View File

@@ -19,6 +19,7 @@
import { render, screen } from '@superset-ui/core/spec';
import LeftCell from './LeftCell';
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
describe('LeftCell', () => {
test('should render column label for column row type', () => {
const columnRow = {

View File

@@ -26,6 +26,7 @@ const mockEntries = [
{ time: '2023-01-04', sales: 400 },
];
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
describe('Sparkline', () => {
test('should render basic sparkline without time ratio', () => {
const column = {

View File

@@ -31,6 +31,7 @@ const mockEntries = [
{ time: '2023-01-01', sales: 100, price: 10 },
];
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
describe('ValueCell', () => {
test('should render simple value without special column type', () => {
render(

View File

@@ -18,6 +18,7 @@
*/
import { controlPanel as controlPanelConfig } from './controlPanel';
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
describe('TimeTable Control Panel', () => {
test('should have required control panel structure', () => {
expect(controlPanelConfig).toBeDefined();

View File

@@ -127,6 +127,7 @@ function createMockChartProps(
return tableChartProps;
}
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
describe('TimeTable transformProps', () => {
test('should transform props correctly for metric rows', () => {
const props = createMockChartProps();

View File

@@ -18,6 +18,7 @@
*/
import { colorFromBounds } from './colorUtils';
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
describe('colorFromBounds', () => {
test('should return null when no bounds are provided', () => {
expect(colorFromBounds(50)).toBeNull();

View File

@@ -24,6 +24,7 @@ const mockData = {
'2023-01-03': { sales: 300 },
};
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
describe('processTimeTableData', () => {
test('should convert data to sorted entries', () => {
const result = processTimeTableData(mockData);

View File

@@ -33,6 +33,7 @@ jest.mock('src/utils/sortNumericValues', () => ({
}),
}));
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
describe('sortNumberWithMixedTypes', () => {
const createMockRow = (value: any) => ({
values: {

View File

@@ -32,6 +32,7 @@ const mockEntries = [
{ time: '2023-01-04', sales: 400 },
];
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
describe('sparklineDataUtils', () => {
test('parseTimeRatio should parse string values', () => {
expect(parseTimeRatio('5')).toBe(5);

View File

@@ -24,7 +24,9 @@ import {
transformChartData,
} from './sparklineHelpers';
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
describe('sparklineHelpers', () => {
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
describe('getSparklineTextWidth', () => {
test('should return a positive number for text width', () => {
const result = getSparklineTextWidth('123.45');
@@ -39,6 +41,7 @@ describe('sparklineHelpers', () => {
});
});
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
describe('isValidBoundValue', () => {
test('should return true for valid numbers', () => {
expect(isValidBoundValue(0)).toBe(true);
@@ -56,6 +59,7 @@ describe('sparklineHelpers', () => {
});
});
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
describe('getDataBounds', () => {
test('should return correct min and max for valid data', () => {
const data = [10, 5, 20, 15];
@@ -90,6 +94,7 @@ describe('sparklineHelpers', () => {
});
});
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
describe('createYScaleConfig', () => {
test('should use data bounds when no axis bounds provided', () => {
const validData = [10, 20, 30];
@@ -144,6 +149,7 @@ describe('sparklineHelpers', () => {
});
});
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
describe('transformChartData', () => {
test('should transform data with indices', () => {
const data = [10, 20, 30];

View File

@@ -25,6 +25,7 @@ import {
} from './valueCalculations';
import type { ColumnConfig, Entry } from '../../types';
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
describe('valueCalculations', () => {
const mockEntries: Entry[] = [
{ time: '2023-01-03', sales: 300, price: 30 },
@@ -32,6 +33,7 @@ describe('valueCalculations', () => {
{ time: '2023-01-01', sales: 100, price: 10 },
];
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
describe('calculateTimeValue', () => {
test('should calculate diff comparison correctly', () => {
const column: ColumnConfig = {
@@ -125,6 +127,7 @@ describe('valueCalculations', () => {
});
});
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
describe('calculateContribution', () => {
test('should calculate contribution correctly', () => {
const result = calculateContribution(300, mockEntries);
@@ -152,6 +155,7 @@ describe('valueCalculations', () => {
});
});
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
describe('calculateAverage', () => {
test('should calculate average correctly', () => {
const column: ColumnConfig = {
@@ -213,6 +217,7 @@ describe('valueCalculations', () => {
});
});
// eslint-disable-next-line no-restricted-globals -- TODO: Migrate from describe blocks
describe('calculateCellValue', () => {
test('should route to time calculation', () => {
const column: ColumnConfig = {