diff --git a/superset-frontend/.eslintrc.js b/superset-frontend/.eslintrc.js
index 7a38fb54fd0..5f4b50ff9d2 100644
--- a/superset-frontend/.eslintrc.js
+++ b/superset-frontend/.eslintrc.js
@@ -446,27 +446,13 @@ module.exports = {
'**/spec/**/*',
],
excludedFiles: 'cypress-base/cypress/**/*',
- plugins: ['jest', 'jest-dom', 'no-only-tests', 'testing-library'],
- env: {
- 'jest/globals': true,
- },
- settings: {
- jest: {
- version: 'detect',
- },
- },
- extends: [
- 'plugin:jest/recommended',
- 'plugin:jest-dom/recommended',
- 'plugin:testing-library/react',
- ],
+ plugins: ['jest-dom', 'no-only-tests', 'testing-library'],
+ extends: ['plugin:jest-dom/recommended', 'plugin:testing-library/react'],
rules: {
'import/no-extraneous-dependencies': [
'error',
{ devDependencies: true },
],
- 'jest/consistent-test-it': 'error',
- 'no-only-tests/no-only-tests': 'error',
'prefer-promise-reject-errors': 0,
'max-classes-per-file': 0,
diff --git a/superset-frontend/oxlint.json b/superset-frontend/oxlint.json
index 78e680df214..81b7523dce5 100644
--- a/superset-frontend/oxlint.json
+++ b/superset-frontend/oxlint.json
@@ -1,10 +1,11 @@
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
- "plugins": ["import", "react", "jsx-a11y", "typescript", "unicorn"],
+ "plugins": ["import", "react", "jest", "jsx-a11y", "typescript", "unicorn"],
"env": {
"browser": true,
"node": true,
- "es2020": true
+ "es2020": true,
+ "jest": true
},
"globals": {
"__webpack_public_path__": "writable",
@@ -256,18 +257,14 @@
"unicorn/no-array-for-each": "off",
"unicorn/prefer-module": "off",
"unicorn/prefer-node-protocol": "off",
- "unicorn/no-useless-undefined": "off"
+ "unicorn/no-useless-undefined": "off",
+
+ // === Jest rules ===
+ "jest/consistent-test-it": ["error", { "fn": "test" }],
+ "jest/no-focused-tests": "error",
+ "jest/no-disabled-tests": "error"
},
"ignorePatterns": [
- "*.test.{js,ts,jsx,tsx}",
- "*.spec.{js,ts,jsx,tsx}",
- "**/__tests__/**",
- "**/__mocks__/**",
- "**/test/**",
- "**/tests/**",
- "**/spec/**",
- "plugins/**/test/**/*",
- "packages/**/test/**/*",
"packages/generator-superset/**/*",
"cypress-base/**",
"node_modules/**",
diff --git a/superset-frontend/package-lock.json b/superset-frontend/package-lock.json
index 753ae927c63..26eb00eb48e 100644
--- a/superset-frontend/package-lock.json
+++ b/superset-frontend/package-lock.json
@@ -238,11 +238,9 @@
"eslint-plugin-file-progress": "^1.5.0",
"eslint-plugin-icons": "file:eslint-rules/eslint-plugin-icons",
"eslint-plugin-import": "^2.32.0",
- "eslint-plugin-jest": "^27.8.0",
"eslint-plugin-jest-dom": "^5.5.0",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-lodash": "^7.4.0",
- "eslint-plugin-no-only-tests": "^3.3.0",
"eslint-plugin-prettier": "^5.5.5",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^7.0.1",
@@ -30747,32 +30745,6 @@
"strip-bom": "^3.0.0"
}
},
- "node_modules/eslint-plugin-jest": {
- "version": "27.9.0",
- "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.9.0.tgz",
- "integrity": "sha512-QIT7FH7fNmd9n4se7FFKHbsLKGQiw885Ds6Y/sxKgCZ6natwCsXdgPOADnYVxN2QrRweF0FZWbJ6S7Rsn7llug==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "@typescript-eslint/utils": "^5.10.0"
- },
- "engines": {
- "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
- },
- "peerDependencies": {
- "@typescript-eslint/eslint-plugin": "^5.0.0 || ^6.0.0 || ^7.0.0",
- "eslint": "^7.0.0 || ^8.0.0",
- "jest": "*"
- },
- "peerDependenciesMeta": {
- "@typescript-eslint/eslint-plugin": {
- "optional": true
- },
- "jest": {
- "optional": true
- }
- }
- },
"node_modules/eslint-plugin-jest-dom": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-jest-dom/-/eslint-plugin-jest-dom-5.5.0.tgz",
@@ -30854,16 +30826,6 @@
"eslint": ">=2"
}
},
- "node_modules/eslint-plugin-no-only-tests": {
- "version": "3.3.0",
- "resolved": "https://registry.npmjs.org/eslint-plugin-no-only-tests/-/eslint-plugin-no-only-tests-3.3.0.tgz",
- "integrity": "sha512-brcKcxGnISN2CcVhXJ/kEQlNa0MEfGRtwKtWA16SkqXHKitaKIMrfemJKLKX1YqDU5C/5JY3PvZXd5jEW04e0Q==",
- "dev": true,
- "license": "MIT",
- "engines": {
- "node": ">=5.0.0"
- }
- },
"node_modules/eslint-plugin-prettier": {
"version": "5.5.5",
"resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-5.5.5.tgz",
diff --git a/superset-frontend/package.json b/superset-frontend/package.json
index ae8cd6ed179..a1bd6d672a1 100644
--- a/superset-frontend/package.json
+++ b/superset-frontend/package.json
@@ -320,11 +320,9 @@
"eslint-plugin-file-progress": "^1.5.0",
"eslint-plugin-icons": "file:eslint-rules/eslint-plugin-icons",
"eslint-plugin-import": "^2.32.0",
- "eslint-plugin-jest": "^27.8.0",
"eslint-plugin-jest-dom": "^5.5.0",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-lodash": "^7.4.0",
- "eslint-plugin-no-only-tests": "^3.3.0",
"eslint-plugin-prettier": "^5.5.5",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^7.0.1",
diff --git a/superset-frontend/packages/superset-core/src/spec/utils/logging.test.ts b/superset-frontend/packages/superset-core/src/spec/utils/logging.test.ts
index 024889ce5e7..11962db4ef9 100644
--- a/superset-frontend/packages/superset-core/src/spec/utils/logging.test.ts
+++ b/superset-frontend/packages/superset-core/src/spec/utils/logging.test.ts
@@ -21,7 +21,7 @@ beforeEach(() => {
jest.resetAllMocks();
});
-it('should pipe to `console` methods', () => {
+test('should pipe to `console` methods', () => {
const { logging } = require('@apache-superset/core');
jest.spyOn(logging, 'debug').mockImplementation();
@@ -49,7 +49,7 @@ it('should pipe to `console` methods', () => {
expect(() => logging.trace()).toThrow('Trace:');
});
-it('should use noop functions when console unavailable', () => {
+test('should use noop functions when console unavailable', () => {
Object.assign(window, { console: undefined });
const { logging } = require('@apache-superset/core');
diff --git a/superset-frontend/packages/superset-ui-chart-controls/src/utils/metricColumnFilter.test.ts b/superset-frontend/packages/superset-ui-chart-controls/src/utils/metricColumnFilter.test.ts
index f227053f86a..f6202263a21 100644
--- a/superset-frontend/packages/superset-ui-chart-controls/src/utils/metricColumnFilter.test.ts
+++ b/superset-frontend/packages/superset-ui-chart-controls/src/utils/metricColumnFilter.test.ts
@@ -45,7 +45,7 @@ describe('metricColumnFilter', () => {
}) as SqlaFormData;
describe('shouldSkipMetricColumn', () => {
- it('should skip unprefixed percent metric columns if prefixed version exists', () => {
+ test('should skip unprefixed percent metric columns if prefixed version exists', () => {
const colnames = ['metric1', '%metric1'];
const formData = createFormData([], ['metric1']);
@@ -58,7 +58,7 @@ describe('metricColumnFilter', () => {
expect(result).toBe(true);
});
- it('should not skip if column is also a regular metric', () => {
+ test('should not skip if column is also a regular metric', () => {
const colnames = ['metric1', '%metric1'];
const formData = createFormData(['metric1'], ['metric1']);
@@ -71,7 +71,7 @@ describe('metricColumnFilter', () => {
expect(result).toBe(false);
});
- it('should not skip if column starts with %', () => {
+ test('should not skip if column starts with %', () => {
const colnames = ['%metric1'];
const formData = createFormData(['metric1'], []);
@@ -84,7 +84,7 @@ describe('metricColumnFilter', () => {
expect(result).toBe(false);
});
- it('should not skip if no prefixed version exists', () => {
+ test('should not skip if no prefixed version exists', () => {
const colnames = ['metric1'];
const formData = createFormData([], ['metric1']);
@@ -99,35 +99,35 @@ describe('metricColumnFilter', () => {
});
describe('isRegularMetric', () => {
- it('should return true for regular metrics', () => {
+ test('should return true for regular metrics', () => {
const formData = createFormData(['metric1', 'metric2'], []);
expect(isRegularMetric('metric1', formData)).toBe(true);
expect(isRegularMetric('metric2', formData)).toBe(true);
});
- it('should return false for non-metrics', () => {
+ test('should return false for non-metrics', () => {
const formData = createFormData(['metric1'], []);
expect(isRegularMetric('non_metric', formData)).toBe(false);
});
- it('should return false for percentage metrics', () => {
+ test('should return false for percentage metrics', () => {
const formData = createFormData([], ['percent_metric1']);
expect(isRegularMetric('percent_metric1', formData)).toBe(false);
});
});
describe('isPercentMetric', () => {
- it('should return true for percentage metrics', () => {
+ test('should return true for percentage metrics', () => {
const formData = createFormData([], ['percent_metric1']);
expect(isPercentMetric('%percent_metric1', formData)).toBe(true);
});
- it('should return false for non-percentage metrics', () => {
+ test('should return false for non-percentage metrics', () => {
const formData = createFormData(['regular_metric'], []);
expect(isPercentMetric('regular_metric', formData)).toBe(false);
});
- it('should return false for regular metrics', () => {
+ test('should return false for regular metrics', () => {
const formData = createFormData(['metric1'], []);
expect(isPercentMetric('metric1', formData)).toBe(false);
});
diff --git a/superset-frontend/packages/superset-ui-chart-controls/test/components/ColumnTypeLabel.test.tsx b/superset-frontend/packages/superset-ui-chart-controls/test/components/ColumnTypeLabel.test.tsx
index a421bfe7a5a..c216fba3291 100644
--- a/superset-frontend/packages/superset-ui-chart-controls/test/components/ColumnTypeLabel.test.tsx
+++ b/superset-frontend/packages/superset-ui-chart-controls/test/components/ColumnTypeLabel.test.tsx
@@ -33,34 +33,34 @@ describe('ColumnOption', () => {
render();
}
- it('is a valid element', () => {
+ test('is a valid element', () => {
expect(isValidElement()).toBe(true);
});
- it('string type shows ABC icon', () => {
+ test('string type shows ABC icon', () => {
renderColumnTypeLabel({ type: GenericDataType.String });
expect(screen.getByLabelText('string type icon')).toBeVisible();
});
- it('int type shows # icon', () => {
+ test('int type shows # icon', () => {
renderColumnTypeLabel({ type: GenericDataType.Numeric });
expect(screen.getByLabelText('numeric type icon')).toBeVisible();
});
- it('bool type shows 1|0 icon', () => {
+ test('bool type shows 1|0 icon', () => {
renderColumnTypeLabel({ type: GenericDataType.Boolean });
expect(screen.getByLabelText('boolean type icon')).toBeVisible();
});
- it('expression type shows function icon', () => {
+ test('expression type shows function icon', () => {
renderColumnTypeLabel({ type: 'expression' });
expect(screen.getByLabelText('function type icon')).toBeVisible();
});
- it('metric type shows sigma icon', () => {
+ test('metric type shows sigma icon', () => {
renderColumnTypeLabel({ type: 'metric' });
expect(screen.getByLabelText('metric type icon')).toBeVisible();
});
- it('unknown type shows question mark', () => {
+ test('unknown type shows question mark', () => {
renderColumnTypeLabel({ type: undefined });
expect(screen.getByLabelText('unknown type icon')).toBeVisible();
});
- it('datetime type displays', () => {
+ test('datetime type displays', () => {
renderColumnTypeLabel({ type: GenericDataType.Temporal });
expect(screen.getByLabelText('temporal type icon')).toBeVisible();
});
diff --git a/superset-frontend/packages/superset-ui-chart-controls/test/index.test.ts b/superset-frontend/packages/superset-ui-chart-controls/test/index.test.ts
index ebde70f8672..1caf219d5cd 100644
--- a/superset-frontend/packages/superset-ui-chart-controls/test/index.test.ts
+++ b/superset-frontend/packages/superset-ui-chart-controls/test/index.test.ts
@@ -19,7 +19,7 @@
import { sections } from '../src';
describe('@superset-ui/chart-controls', () => {
- it('exports sections', () => {
+ test('exports sections', () => {
expect(sections).toBeDefined();
expect(sections.datasourceAndVizType).toBeDefined();
});
diff --git a/superset-frontend/packages/superset-ui-chart-controls/test/operators/aggregateOperator.test.ts b/superset-frontend/packages/superset-ui-chart-controls/test/operators/aggregateOperator.test.ts
index ddc8d5785a8..52e3e454078 100644
--- a/superset-frontend/packages/superset-ui-chart-controls/test/operators/aggregateOperator.test.ts
+++ b/superset-frontend/packages/superset-ui-chart-controls/test/operators/aggregateOperator.test.ts
@@ -40,7 +40,7 @@ describe('aggregationOperator', () => {
granularity: 'month',
};
- it('should return undefined for LAST_VALUE aggregation', () => {
+ test('should return undefined for LAST_VALUE aggregation', () => {
const formDataWithLastValue = {
...formData,
aggregation: 'LAST_VALUE',
@@ -51,7 +51,7 @@ describe('aggregationOperator', () => {
).toBeUndefined();
});
- it('should return undefined when metrics is empty', () => {
+ test('should return undefined when metrics is empty', () => {
const queryObjectWithoutMetrics = {
...queryObject,
metrics: [],
@@ -67,7 +67,7 @@ describe('aggregationOperator', () => {
).toBeUndefined();
});
- it('should apply sum aggregation to all metrics', () => {
+ test('should apply sum aggregation to all metrics', () => {
const formDataWithSum = {
...formData,
aggregation: 'sum',
@@ -91,7 +91,7 @@ describe('aggregationOperator', () => {
});
});
- it('should apply mean aggregation to all metrics', () => {
+ test('should apply mean aggregation to all metrics', () => {
const formDataWithMean = {
...formData,
aggregation: 'mean',
@@ -115,7 +115,7 @@ describe('aggregationOperator', () => {
});
});
- it('should use default aggregation when not specified', () => {
+ test('should use default aggregation when not specified', () => {
expect(aggregationOperator(formData, queryObject)).toBeUndefined();
});
});
diff --git a/superset-frontend/packages/superset-ui-chart-controls/test/utils/colorControls.test.ts b/superset-frontend/packages/superset-ui-chart-controls/test/utils/colorControls.test.ts
index deadc3eedef..abe64f79efe 100644
--- a/superset-frontend/packages/superset-ui-chart-controls/test/utils/colorControls.test.ts
+++ b/superset-frontend/packages/superset-ui-chart-controls/test/utils/colorControls.test.ts
@@ -19,7 +19,7 @@
import { getColorControlsProps } from '../../src';
describe('getColorControlsProps', () => {
- it('should return default values when state is empty', () => {
+ test('should return default values when state is empty', () => {
const state = {};
const result = getColorControlsProps(state);
expect(result).toEqual({
@@ -33,7 +33,7 @@ describe('getColorControlsProps', () => {
});
});
- it('should return correct values when state has form_data with dashboardId and color scheme', () => {
+ test('should return correct values when state has form_data with dashboardId and color scheme', () => {
const state = {
form_data: {
dashboardId: 123,
@@ -54,7 +54,7 @@ describe('getColorControlsProps', () => {
});
});
- it('should detect custom label colors correctly', () => {
+ test('should detect custom label colors correctly', () => {
const state = {
form_data: {
dashboardId: 123,
@@ -74,7 +74,7 @@ describe('getColorControlsProps', () => {
});
});
- it('should return shared label colors when available', () => {
+ test('should return shared label colors when available', () => {
const state = {
form_data: {
shared_label_colors: ['#FF5733', '#33FF57'],
@@ -92,7 +92,7 @@ describe('getColorControlsProps', () => {
});
});
- it('should handle missing form_data and slice properties', () => {
+ test('should handle missing form_data and slice properties', () => {
const state = {
form_data: {
dashboardId: 789,
diff --git a/superset-frontend/packages/superset-ui-chart-controls/test/utils/columnChoices.test.tsx b/superset-frontend/packages/superset-ui-chart-controls/test/utils/columnChoices.test.tsx
index 354ae572f9e..bc135886b54 100644
--- a/superset-frontend/packages/superset-ui-chart-controls/test/utils/columnChoices.test.tsx
+++ b/superset-frontend/packages/superset-ui-chart-controls/test/utils/columnChoices.test.tsx
@@ -21,7 +21,7 @@ import { GenericDataType } from '@apache-superset/core/api/core';
import { columnChoices } from '../../src';
describe('columnChoices()', () => {
- it('should convert columns to choices when source is a Dataset', () => {
+ test('should convert columns to choices when source is a Dataset', () => {
expect(
columnChoices({
id: 1,
@@ -60,11 +60,11 @@ describe('columnChoices()', () => {
]);
});
- it('should return empty array when no columns', () => {
+ test('should return empty array when no columns', () => {
expect(columnChoices(undefined)).toEqual([]);
});
- it('should convert columns to choices when source is a Query', () => {
+ test('should convert columns to choices when source is a Query', () => {
expect(columnChoices(testQueryResponse)).toEqual([
['Column 1', 'Column 1'],
['Column 2', 'Column 2'],
@@ -72,12 +72,12 @@ describe('columnChoices()', () => {
]);
});
- it('should return choices of a specific type', () => {
+ test('should return choices of a specific type', () => {
expect(columnChoices(testQueryResponse, GenericDataType.Temporal)).toEqual([
['Column 2', 'Column 2'],
]);
});
- it('should use name when verbose_name key exists but is not defined', () => {
+ test('should use name when verbose_name key exists but is not defined', () => {
expect(
columnChoices({
id: 1,
diff --git a/superset-frontend/packages/superset-ui-chart-controls/test/utils/defineSavedMetrics.test.tsx b/superset-frontend/packages/superset-ui-chart-controls/test/utils/defineSavedMetrics.test.tsx
index a32a49028da..b69d2c56a7f 100644
--- a/superset-frontend/packages/superset-ui-chart-controls/test/utils/defineSavedMetrics.test.tsx
+++ b/superset-frontend/packages/superset-ui-chart-controls/test/utils/defineSavedMetrics.test.tsx
@@ -25,7 +25,7 @@ import {
import { defineSavedMetrics } from '@superset-ui/chart-controls';
describe('defineSavedMetrics', () => {
- it('defines saved metrics if source is a Dataset', () => {
+ test('defines saved metrics if source is a Dataset', () => {
const dataset = {
id: 1,
metrics: [
@@ -55,7 +55,7 @@ describe('defineSavedMetrics', () => {
expect(defineSavedMetrics({ ...dataset, metrics: undefined })).toEqual([]);
});
- it('returns default saved metrics if source is a Query', () => {
+ test('returns default saved metrics if source is a Query', () => {
expect(defineSavedMetrics(testQuery as QueryResponse)).toEqual(
DEFAULT_METRICS,
);
diff --git a/superset-frontend/packages/superset-ui-chart-controls/test/utils/expandControlConfig.test.tsx b/superset-frontend/packages/superset-ui-chart-controls/test/utils/expandControlConfig.test.tsx
index db9b01a6dde..ff8a6adf0a2 100644
--- a/superset-frontend/packages/superset-ui-chart-controls/test/utils/expandControlConfig.test.tsx
+++ b/superset-frontend/packages/superset-ui-chart-controls/test/utils/expandControlConfig.test.tsx
@@ -24,14 +24,14 @@ import {
} from '../../src';
describe('expandControlConfig()', () => {
- it('expands shared control alias', () => {
+ test('expands shared control alias', () => {
expect(expandControlConfig('metrics')).toEqual({
name: 'metrics',
config: sharedControls.metrics,
});
});
- it('expands control with overrides', () => {
+ test('expands control with overrides', () => {
expect(
expandControlConfig({
name: 'metrics',
@@ -48,7 +48,7 @@ describe('expandControlConfig()', () => {
});
});
- it('leave full control untouched', () => {
+ test('leave full control untouched', () => {
const input = {
name: 'metrics',
config: {
@@ -59,7 +59,7 @@ describe('expandControlConfig()', () => {
expect(expandControlConfig(input)).toEqual(input);
});
- it('load shared components in chart-controls', () => {
+ test('load shared components in chart-controls', () => {
const input = {
name: 'metrics',
config: {
@@ -72,18 +72,18 @@ describe('expandControlConfig()', () => {
).toEqual(sharedControlComponents.RadioButtonControl);
});
- it('leave NULL and ReactElement untouched', () => {
+ test('leave NULL and ReactElement untouched', () => {
expect(expandControlConfig(null)).toBeNull();
const input =
Test
;
expect(expandControlConfig(input)).toBe(input);
});
- it('leave unknown text untouched', () => {
+ test('leave unknown text untouched', () => {
const input = 'superset-ui';
expect(expandControlConfig(input as never)).toBe(input);
});
- it('return null for invalid configs', () => {
+ test('return null for invalid configs', () => {
expect(
expandControlConfig({ type: 'SelectControl', label: 'Hello' } as never),
).toBeNull();
diff --git a/superset-frontend/packages/superset-ui-chart-controls/test/utils/mainMetric.test.ts b/superset-frontend/packages/superset-ui-chart-controls/test/utils/mainMetric.test.ts
index 4b009766428..744e9452190 100644
--- a/superset-frontend/packages/superset-ui-chart-controls/test/utils/mainMetric.test.ts
+++ b/superset-frontend/packages/superset-ui-chart-controls/test/utils/mainMetric.test.ts
@@ -19,25 +19,25 @@
import { mainMetric } from '../../src';
describe('mainMetric', () => {
- it('is null when no options', () => {
+ test('is null when no options', () => {
expect(mainMetric([])).toBeUndefined();
expect(mainMetric(null)).toBeUndefined();
});
- it('prefers the "count" metric when first', () => {
+ test('prefers the "count" metric when first', () => {
const metrics = [
{ metric_name: 'count', uuid: '1' },
{ metric_name: 'foo', uuid: '2' },
];
expect(mainMetric(metrics)).toBe('count');
});
- it('prefers the "count" metric when not first', () => {
+ test('prefers the "count" metric when not first', () => {
const metrics = [
{ metric_name: 'foo', uuid: '1' },
{ metric_name: 'count', uuid: '2' },
];
expect(mainMetric(metrics)).toBe('count');
});
- it('selects the first metric when "count" is not an option', () => {
+ test('selects the first metric when "count" is not an option', () => {
const metrics = [
{ metric_name: 'foo', uuid: '2' },
{ metric_name: 'not_count', uuid: '2' },
diff --git a/superset-frontend/packages/superset-ui-chart-controls/test/utils/selectOptions.test.ts b/superset-frontend/packages/superset-ui-chart-controls/test/utils/selectOptions.test.ts
index 91b6895b090..d46b840225b 100644
--- a/superset-frontend/packages/superset-ui-chart-controls/test/utils/selectOptions.test.ts
+++ b/superset-frontend/packages/superset-ui-chart-controls/test/utils/selectOptions.test.ts
@@ -19,7 +19,7 @@
import { formatSelectOptions, formatSelectOptionsForRange } from '../../src';
describe('formatSelectOptions', () => {
- it('formats an array of options', () => {
+ test('formats an array of options', () => {
expect(formatSelectOptions([1, 5, 10, 25, 50, 'unlimited'])).toEqual([
[1, '1'],
[5, '5'],
@@ -29,7 +29,7 @@ describe('formatSelectOptions', () => {
['unlimited', 'unlimited'],
]);
});
- it('formats a mix of values and already formated options', () => {
+ test('formats a mix of values and already formated options', () => {
expect(
formatSelectOptions([
[0, 'all'],
@@ -53,7 +53,7 @@ describe('formatSelectOptions', () => {
});
describe('formatSelectOptionsForRange', () => {
- it('generates select options from a range', () => {
+ test('generates select options from a range', () => {
expect(formatSelectOptionsForRange(1, 5)).toEqual([
[1, '1'],
[2, '2'],
diff --git a/superset-frontend/packages/superset-ui-core/src/components/AsyncAceEditor/useJsonValidation.test.ts b/superset-frontend/packages/superset-ui-core/src/components/AsyncAceEditor/useJsonValidation.test.ts
index 9156072fdb1..bab4cc313df 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/AsyncAceEditor/useJsonValidation.test.ts
+++ b/superset-frontend/packages/superset-ui-core/src/components/AsyncAceEditor/useJsonValidation.test.ts
@@ -20,24 +20,24 @@ import { renderHook } from '@testing-library/react-hooks';
import { useJsonValidation } from './useJsonValidation';
describe('useJsonValidation', () => {
- it('returns empty array for valid JSON', () => {
+ test('returns empty array for valid JSON', () => {
const { result } = renderHook(() => useJsonValidation('{"key": "value"}'));
expect(result.current).toEqual([]);
});
- it('returns empty array when disabled', () => {
+ test('returns empty array when disabled', () => {
const { result } = renderHook(() =>
useJsonValidation('invalid json', { enabled: false }),
);
expect(result.current).toEqual([]);
});
- it('returns empty array for empty input', () => {
+ test('returns empty array for empty input', () => {
const { result } = renderHook(() => useJsonValidation(''));
expect(result.current).toEqual([]);
});
- it('extracts line and column from error message with parentheses', () => {
+ test('extracts line and column from error message with parentheses', () => {
// Since we can't control the exact error message from JSON.parse,
// let's test with a mock that demonstrates the pattern matching
const mockError = {
@@ -52,7 +52,7 @@ describe('useJsonValidation', () => {
expect(match![2]).toBe('2');
});
- it('returns error on first line when no line/column info in message', () => {
+ test('returns error on first line when no line/column info in message', () => {
const invalidJson = '{invalid}';
const { result } = renderHook(() => useJsonValidation(invalidJson));
@@ -65,7 +65,7 @@ describe('useJsonValidation', () => {
});
});
- it('uses custom error prefix', () => {
+ test('uses custom error prefix', () => {
const { result } = renderHook(() =>
useJsonValidation('{invalid}', { errorPrefix: 'Custom error' }),
);
diff --git a/superset-frontend/packages/superset-ui-core/src/components/AutoComplete/AutoComplete.test.tsx b/superset-frontend/packages/superset-ui-core/src/components/AutoComplete/AutoComplete.test.tsx
index a69e2924cf2..f72ccaaeb40 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/AutoComplete/AutoComplete.test.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/components/AutoComplete/AutoComplete.test.tsx
@@ -44,14 +44,14 @@ const AutoCompleteTest = () => {
};
describe('AutoComplete Component', () => {
- it('renders input field', () => {
+ test('renders input field', () => {
render();
expect(
screen.getByPlaceholderText('Type to search...'),
).toBeInTheDocument();
});
- it('shows options when user types', async () => {
+ test('shows options when user types', async () => {
render();
const input = screen.getByPlaceholderText('Type to search...');
await userEvent.type(input, 'test');
@@ -63,7 +63,7 @@ describe('AutoComplete Component', () => {
});
});
- it('selecting an option updates input value', async () => {
+ test('selecting an option updates input value', async () => {
render();
const input = screen.getByPlaceholderText('Type to search...');
await userEvent.type(input, 'test');
diff --git a/superset-frontend/packages/superset-ui-core/src/components/Breadcrumb/Breadcrumb.test.tsx b/superset-frontend/packages/superset-ui-core/src/components/Breadcrumb/Breadcrumb.test.tsx
index bd45b713059..f07d7b21a8c 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/Breadcrumb/Breadcrumb.test.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/components/Breadcrumb/Breadcrumb.test.tsx
@@ -21,7 +21,7 @@ import '@testing-library/jest-dom';
import { Breadcrumb } from '.';
describe('Breadcrumb Component', () => {
- it('renders breadcrumb items correctly', () => {
+ test('renders breadcrumb items correctly', () => {
render(
Home
diff --git a/superset-frontend/packages/superset-ui-core/src/components/CachedLabel/CachedLabel.test.tsx b/superset-frontend/packages/superset-ui-core/src/components/CachedLabel/CachedLabel.test.tsx
index 59d9d63088c..fa70153b39d 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/CachedLabel/CachedLabel.test.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/components/CachedLabel/CachedLabel.test.tsx
@@ -30,11 +30,11 @@ const defaultProps = {
const setup = (props: CacheLabelProps) => ;
describe('CachedLabel', () => {
- it('is valid', () => {
+ test('is valid', () => {
expect(isValidElement()).toBe(true);
});
- it('renders', () => {
+ test('renders', () => {
render(setup(defaultProps));
const label = screen.getByText(/cached/i);
diff --git a/superset-frontend/packages/superset-ui-core/src/components/Checkbox/Checkbox.test.tsx b/superset-frontend/packages/superset-ui-core/src/components/Checkbox/Checkbox.test.tsx
index 0b88e0297ab..8a8de3758d7 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/Checkbox/Checkbox.test.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/components/Checkbox/Checkbox.test.tsx
@@ -39,37 +39,37 @@ describe('Checkbox Component', () => {
});
describe('Rendering', () => {
- it('should render correctly', async () => {
+ test('should render correctly', async () => {
const { container } = await asyncRender();
expect(container).toBeInTheDocument();
});
- it('should render the label', async () => {
+ test('should render the label', async () => {
await asyncRender();
expect(screen.getByText('Checkbox Label')).toBeInTheDocument();
});
- it('should render the checkbox', async () => {
+ test('should render the checkbox', async () => {
await asyncRender();
expect(screen.getByRole('checkbox')).toBeInTheDocument();
});
});
describe('States', () => {
- it('should render as unchecked when checked is false', async () => {
+ test('should render as unchecked when checked is false', async () => {
await asyncRender();
const checkbox = screen.getByRole('checkbox');
expect(checkbox).not.toBeChecked();
});
- it('should render as checked when checked is true', async () => {
+ test('should render as checked when checked is true', async () => {
const checkedProps = { ...mockedProps, checked: true };
await asyncRender(checkedProps);
const checkbox = screen.getByRole('checkbox');
expect(checkbox).toBeChecked();
});
- it('should render as indeterminate when indeterminate is true', async () => {
+ test('should render as indeterminate when indeterminate is true', async () => {
const indeterminateProps = { ...mockedProps, indeterminate: true };
await asyncRender(indeterminateProps);
const checkbox = screen.getByRole('checkbox');
@@ -77,7 +77,7 @@ describe('Checkbox Component', () => {
expect((checkbox as HTMLInputElement).indeterminate).toBe(true);
});
- it('should render as disabled when disabled prop is true', async () => {
+ test('should render as disabled when disabled prop is true', async () => {
const disabledProps = { ...mockedProps, disabled: true };
await asyncRender(disabledProps);
expect(screen.getByRole('checkbox')).toBeDisabled();
@@ -85,14 +85,14 @@ describe('Checkbox Component', () => {
});
describe('Interactions', () => {
- it('should call the onChange handler when clicked', async () => {
+ test('should call the onChange handler when clicked', async () => {
await asyncRender();
const checkbox = screen.getByRole('checkbox');
await userEvent.click(checkbox);
expect(mockedProps.onChange).toHaveBeenCalledTimes(1);
});
- it('should not call the onChange handler when disabled and clicked', async () => {
+ test('should not call the onChange handler when disabled and clicked', async () => {
const mockOnChange = jest.fn();
const disabledProps = {
...mockedProps,
@@ -108,7 +108,7 @@ describe('Checkbox Component', () => {
expect(mockOnChange).not.toHaveBeenCalled();
});
- it('calls onChange handler successfully', async () => {
+ test('calls onChange handler successfully', async () => {
const mockAction = jest.fn();
render();
const checkboxInput = screen.getByRole('checkbox');
diff --git a/superset-frontend/packages/superset-ui-core/src/components/CodeSyntaxHighlighter/index.test.tsx b/superset-frontend/packages/superset-ui-core/src/components/CodeSyntaxHighlighter/index.test.tsx
index f4c04a90069..8734447c302 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/CodeSyntaxHighlighter/index.test.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/components/CodeSyntaxHighlighter/index.test.tsx
@@ -58,20 +58,20 @@ jest.mock(
);
describe('CodeSyntaxHighlighter', () => {
- it('renders code content', () => {
+ test('renders code content', () => {
render(SELECT * FROM users;);
expect(screen.getByText('SELECT * FROM users;')).toBeInTheDocument();
});
- it('renders with default SQL language', () => {
+ test('renders with default SQL language', () => {
render(SELECT * FROM users;);
// Should show content (the important thing is content is visible)
expect(screen.getByText('SELECT * FROM users;')).toBeInTheDocument();
});
- it('renders with specified language', () => {
+ test('renders with specified language', () => {
render(
{`{ "key": "value" }`}
@@ -82,7 +82,7 @@ describe('CodeSyntaxHighlighter', () => {
expect(screen.getByText('{ "key": "value" }')).toBeInTheDocument();
});
- it('supports all expected languages', () => {
+ test('supports all expected languages', () => {
const languages = ['sql', 'json', 'htmlbars', 'markdown'] as const;
languages.forEach(language => {
@@ -101,7 +101,7 @@ describe('CodeSyntaxHighlighter', () => {
});
});
- it('renders fallback pre element initially', () => {
+ test('renders fallback pre element initially', () => {
render(
SELECT COUNT(*) FROM table;
@@ -112,7 +112,7 @@ describe('CodeSyntaxHighlighter', () => {
expect(screen.getByText('SELECT COUNT(*) FROM table;')).toBeInTheDocument();
});
- it('handles special characters', () => {
+ test('handles special characters', () => {
const specialContent = "SELECT * FROM `users` WHERE name = 'O\\'Brien';";
render(
@@ -124,7 +124,7 @@ describe('CodeSyntaxHighlighter', () => {
expect(screen.getByText(specialContent)).toBeInTheDocument();
});
- it('accepts custom styles', () => {
+ test('accepts custom styles', () => {
render(
SELECT * FROM users;
@@ -134,7 +134,7 @@ describe('CodeSyntaxHighlighter', () => {
expect(screen.getByText('SELECT * FROM users;')).toBeInTheDocument();
});
- it('accepts showLineNumbers prop', () => {
+ test('accepts showLineNumbers prop', () => {
render(
SELECT * FROM users;
@@ -144,7 +144,7 @@ describe('CodeSyntaxHighlighter', () => {
expect(screen.getByText('SELECT * FROM users;')).toBeInTheDocument();
});
- it('accepts wrapLines prop', () => {
+ test('accepts wrapLines prop', () => {
render(
SELECT * FROM users;
diff --git a/superset-frontend/packages/superset-ui-core/src/components/Dropdown/Dropdown.test.tsx b/superset-frontend/packages/superset-ui-core/src/components/Dropdown/Dropdown.test.tsx
index 02ef9440581..5f1d44bae99 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/Dropdown/Dropdown.test.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/components/Dropdown/Dropdown.test.tsx
@@ -24,14 +24,14 @@ const props = {
overlay: Test Overlay
,
};
describe('NoAnimationDropdown', () => {
- it('requires children', () => {
+ test('requires children', () => {
expect(() => {
// @ts-expect-error need to test the error case
render();
}).toThrow();
});
- it('renders its children', () => {
+ test('renders its children', () => {
render(
@@ -40,7 +40,7 @@ describe('NoAnimationDropdown', () => {
expect(screen.getByText('Test Button')).toBeInTheDocument();
});
- it('calls onBlur when it loses focus', () => {
+ test('calls onBlur when it loses focus', () => {
const onBlur = jest.fn();
render(
@@ -51,7 +51,7 @@ describe('NoAnimationDropdown', () => {
expect(onBlur).toHaveBeenCalled();
});
- it('calls onKeyDown when a key is pressed', () => {
+ test('calls onKeyDown when a key is pressed', () => {
const onKeyDown = jest.fn();
render(
diff --git a/superset-frontend/packages/superset-ui-core/src/components/DynamicEditableTitle/DynamicEditableTitle.test.tsx b/superset-frontend/packages/superset-ui-core/src/components/DynamicEditableTitle/DynamicEditableTitle.test.tsx
index c8e0ba13314..86476745fed 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/DynamicEditableTitle/DynamicEditableTitle.test.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/components/DynamicEditableTitle/DynamicEditableTitle.test.tsx
@@ -29,13 +29,13 @@ const createProps = (overrides: Record = {}) => ({
});
describe('Chart editable title', () => {
- it('renders chart title', () => {
+ test('renders chart title', () => {
const props = createProps();
render();
expect(screen.getByText('Chart title')).toBeVisible();
});
- it('renders placeholder', () => {
+ test('renders placeholder', () => {
const props = createProps({
title: '',
});
@@ -43,7 +43,7 @@ describe('Chart editable title', () => {
expect(screen.getByText('Add the name of the chart')).toBeVisible();
});
- it('click, edit and save title', async () => {
+ test('click, edit and save title', async () => {
const props = createProps();
render();
const textboxElement = screen.getByRole('textbox');
@@ -54,7 +54,7 @@ describe('Chart editable title', () => {
expect(props.onSave).toHaveBeenCalled();
});
- it('renders in non-editable mode', async () => {
+ test('renders in non-editable mode', async () => {
const props = createProps({ canEdit: false });
render();
const titleElement = screen.getByLabelText('Chart title');
diff --git a/superset-frontend/packages/superset-ui-core/src/components/EditableTitle/EditableTitle.test.tsx b/superset-frontend/packages/superset-ui-core/src/components/EditableTitle/EditableTitle.test.tsx
index 4440c116e24..c8028d050bb 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/EditableTitle/EditableTitle.test.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/components/EditableTitle/EditableTitle.test.tsx
@@ -48,7 +48,7 @@ test('should not render an input if it is not editable', () => {
});
describe('should handle click', () => {
- it('should enable editing mode on click', () => {
+ test('should enable editing mode on click', () => {
const { getByTestId, container } = render();
fireEvent.click(getByTestId('textarea-editable-title-input'));
@@ -59,7 +59,7 @@ describe('should handle click', () => {
});
describe('should handle change', () => {
- it('should change title', () => {
+ test('should change title', () => {
const { getByTestId } = render();
const textarea = getByTestId('textarea-editable-title-input');
fireEvent.change(textarea, mockEvent);
@@ -74,7 +74,7 @@ describe('should handle blur', () => {
return selectors;
};
- it('should trigger callback', () => {
+ test('should trigger callback', () => {
const callback = jest.fn();
const { getByTestId } = setup({ onSaveTitle: callback });
fireEvent.change(getByTestId('textarea-editable-title-input'), mockEvent);
@@ -83,7 +83,7 @@ describe('should handle blur', () => {
expect(callback).toHaveBeenCalledWith('new title');
});
- it('should not trigger callback', () => {
+ test('should not trigger callback', () => {
const callback = jest.fn();
const { getByTestId } = setup({ onSaveTitle: callback });
fireEvent.blur(getByTestId('textarea-editable-title-input'));
@@ -91,7 +91,7 @@ describe('should handle blur', () => {
expect(callback).not.toHaveBeenCalled();
});
- it('should not save empty title', () => {
+ test('should not save empty title', () => {
const callback = jest.fn();
const { getByTestId } = setup({ onSaveTitle: callback });
const textarea = getByTestId('textarea-editable-title-input');
diff --git a/superset-frontend/packages/superset-ui-core/src/components/Form/LabeledErrorBoundInput.test.tsx b/superset-frontend/packages/superset-ui-core/src/components/Form/LabeledErrorBoundInput.test.tsx
index 2feca1d0fd7..598747de8b5 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/Form/LabeledErrorBoundInput.test.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/components/Form/LabeledErrorBoundInput.test.tsx
@@ -35,7 +35,7 @@ const defaultProps: LabeledErrorBoundInputProps = {
};
describe('LabeledErrorBoundInput', () => {
- it('renders a LabeledErrorBoundInput normally, without an error', () => {
+ test('renders a LabeledErrorBoundInput normally, without an error', () => {
render();
const label = screen.getByText(/username/i);
@@ -47,7 +47,7 @@ describe('LabeledErrorBoundInput', () => {
expect(helperText).toBeVisible();
});
- it('renders a LabeledErrorBoundInput with an error', () => {
+ test('renders a LabeledErrorBoundInput with an error', () => {
// Pass an error into props, causing errorText to replace helperText
defaultProps.errorMessage = 'Example error message';
render();
@@ -60,7 +60,7 @@ describe('LabeledErrorBoundInput', () => {
expect(textboxInput).toBeVisible();
expect(errorText).toBeVisible();
});
- it('renders a LabeledErrorBoundInput with a InfoTooltip', async () => {
+ test('renders a LabeledErrorBoundInput with a InfoTooltip', async () => {
defaultProps.hasTooltip = true;
render();
@@ -76,14 +76,14 @@ describe('LabeledErrorBoundInput', () => {
expect(await screen.findByText('This is a tooltip')).toBeInTheDocument();
});
- it('becomes a password input if visibilityToggle prop is passed in', async () => {
+ test('becomes a password input if visibilityToggle prop is passed in', async () => {
defaultProps.visibilityToggle = true;
render();
expect(await screen.findByTestId('icon-eye')).toBeVisible();
});
- it('becomes a password input if props.name === password (backwards compatibility)', async () => {
+ test('becomes a password input if props.name === password (backwards compatibility)', async () => {
defaultProps.name = 'password';
render();
diff --git a/superset-frontend/packages/superset-ui-core/src/components/Grid/Grid.test.tsx b/superset-frontend/packages/superset-ui-core/src/components/Grid/Grid.test.tsx
index 884ce75ed3b..eb0e9ff268f 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/Grid/Grid.test.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/components/Grid/Grid.test.tsx
@@ -21,7 +21,7 @@ import '@testing-library/jest-dom';
import { Col, Row } from '.';
describe('Grid Component', () => {
- it('should render the grid with rows and columns', async () => {
+ test('should render the grid with rows and columns', async () => {
render(
Column 1
diff --git a/superset-frontend/packages/superset-ui-core/src/components/IconButton/IconButton.test.tsx b/superset-frontend/packages/superset-ui-core/src/components/IconButton/IconButton.test.tsx
index 16448a92467..4e0a81bbbb5 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/IconButton/IconButton.test.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/components/IconButton/IconButton.test.tsx
@@ -25,7 +25,7 @@ const defaultProps = {
};
describe('IconButton', () => {
- it('renders an IconButton with icon and text', () => {
+ test('renders an IconButton with icon and text', () => {
render();
const icon = screen.getByRole('img');
@@ -35,7 +35,7 @@ describe('IconButton', () => {
expect(buttonText).toBeVisible();
});
- it('is keyboard accessible and has correct aria attributes', () => {
+ test('is keyboard accessible and has correct aria attributes', () => {
render();
const button = screen.getByRole('button');
@@ -44,7 +44,7 @@ describe('IconButton', () => {
expect(button).toHaveAttribute('aria-label', defaultProps.buttonText);
});
- it('handles Enter and Space key presses', () => {
+ test('handles Enter and Space key presses', () => {
const mockOnClick = jest.fn();
render();
@@ -57,7 +57,7 @@ describe('IconButton', () => {
expect(mockOnClick).toHaveBeenCalledTimes(2);
});
- it('uses custom alt text when provided', () => {
+ test('uses custom alt text when provided', () => {
const customAltText = 'Custom Alt Text';
render(
{
expect(icon).toBeVisible();
});
- it('displays tooltip with button text', () => {
+ test('displays tooltip with button text', () => {
render();
const tooltipTrigger = screen.getByText(/this is the iconbutton text/i);
expect(tooltipTrigger).toBeVisible();
});
- it('calls onClick handler when clicked', () => {
+ test('calls onClick handler when clicked', () => {
const mockOnClick = jest.fn();
render();
diff --git a/superset-frontend/packages/superset-ui-core/src/components/Layout/Layout.test.tsx b/superset-frontend/packages/superset-ui-core/src/components/Layout/Layout.test.tsx
index cb79d78da5b..88a70ff9e6e 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/Layout/Layout.test.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/components/Layout/Layout.test.tsx
@@ -22,7 +22,7 @@ import { Layout } from '.';
import { Button } from '../Button';
describe('Layout Component', () => {
- it('renders Layout with Header, Content, and Footer', () => {
+ test('renders Layout with Header, Content, and Footer', () => {
render(
Header
@@ -36,7 +36,7 @@ describe('Layout Component', () => {
expect(screen.getByText('Ant Design Layout Footer')).toBeInTheDocument();
});
- it('renders Layout with Sider when hasSider is true', () => {
+ test('renders Layout with Sider when hasSider is true', () => {
render(
Sider Content
@@ -46,7 +46,7 @@ describe('Layout Component', () => {
expect(screen.getByText('Sider Content')).toBeInTheDocument();
});
- it('hides Header when headerVisible is false', () => {
+ test('hides Header when headerVisible is false', () => {
render(
{false && Header}
@@ -58,7 +58,7 @@ describe('Layout Component', () => {
expect(screen.queryByText('Header')).not.toBeInTheDocument();
});
- it('hides Footer when footerVisible is false', () => {
+ test('hides Footer when footerVisible is false', () => {
render(
Header
@@ -71,7 +71,7 @@ describe('Layout Component', () => {
screen.queryByText('Ant Design Layout Footer'),
).not.toBeInTheDocument();
});
- it('collapses Sider when clicked', () => {
+ test('collapses Sider when clicked', () => {
const TestLayout = () => {
const [collapsed, setCollapsed] = useState(false);
diff --git a/superset-frontend/packages/superset-ui-core/src/components/ListViewCard/ImageLoader.test.tsx b/superset-frontend/packages/superset-ui-core/src/components/ListViewCard/ImageLoader.test.tsx
index ad31e512f29..039054ce34a 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/ListViewCard/ImageLoader.test.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/components/ListViewCard/ImageLoader.test.tsx
@@ -52,12 +52,12 @@ describe('ImageLoader', () => {
afterEach(() => fetchMock.clearHistory());
- it('is a valid element', async () => {
+ test('is a valid element', async () => {
setup();
expect(await screen.findByTestId('image-loader')).toBeVisible();
});
- it('fetches loads the image in the background', async () => {
+ test('fetches loads the image in the background', async () => {
setup();
expect(screen.getByTestId('image-loader')).toHaveAttribute(
'src',
@@ -71,7 +71,7 @@ describe('ImageLoader', () => {
);
});
- it('displays fallback image when response is not an image', async () => {
+ test('displays fallback image when response is not an image', async () => {
fetchMock.once('glob:*/thumbnail2', {}, { name: 'thumbnail2' });
setup({ src: 'glob:*/thumbnail2' });
diff --git a/superset-frontend/packages/superset-ui-core/src/components/ListViewCard/ListViewCard.test.tsx b/superset-frontend/packages/superset-ui-core/src/components/ListViewCard/ListViewCard.test.tsx
index 4c21d68e2ea..190fc6eb401 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/ListViewCard/ListViewCard.test.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/components/ListViewCard/ListViewCard.test.tsx
@@ -47,17 +47,17 @@ describe('ListViewCard', () => {
render();
});
- it('is a valid element', () => {
+ test('is a valid element', () => {
expect(screen.getByTestId('styled-card')).toBeInTheDocument();
});
- it('renders Actions', () => {
+ test('renders Actions', () => {
expect(screen.getByTestId('card-actions')).toBeVisible();
expect(screen.getByText('Action 1')).toBeVisible();
expect(screen.getByText('Action 2')).toBeVisible();
});
- it('renders an ImageLoader', () => {
+ test('renders an ImageLoader', () => {
expect(screen.getByTestId('image-loader')).toBeVisible();
});
});
diff --git a/superset-frontend/packages/superset-ui-core/src/components/Modal/FormModal.test.tsx b/superset-frontend/packages/superset-ui-core/src/components/Modal/FormModal.test.tsx
index 400efe668e4..d69b02ba170 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/Modal/FormModal.test.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/components/Modal/FormModal.test.tsx
@@ -58,21 +58,21 @@ describe('FormModal Component', () => {
const renderComponent = () => render();
- it('should render the modal with two input fields', () => {
+ test('should render the modal with two input fields', () => {
renderComponent();
expect(screen.getByLabelText('Name')).toBeInTheDocument();
expect(screen.getByLabelText('Email')).toBeInTheDocument();
});
- it('should disable Save button when required fields are empty', async () => {
+ test('should disable Save button when required fields are empty', async () => {
renderComponent();
const saveButton = screen.getByTestId('form-modal-save-button');
expect(saveButton).toBeDisabled();
});
- it('should enable Save button only when the required field is filled', async () => {
+ test('should enable Save button only when the required field is filled', async () => {
renderComponent();
const nameInput = screen.getByPlaceholderText('Enter your name');
@@ -83,7 +83,7 @@ describe('FormModal Component', () => {
});
});
- it('should keep Save button disabled when only the optional field is filled', async () => {
+ test('should keep Save button disabled when only the optional field is filled', async () => {
renderComponent();
const emailInput = screen.getByPlaceholderText('Enter your email');
@@ -94,7 +94,7 @@ describe('FormModal Component', () => {
});
});
- it('should call formSubmitHandler with correct values when submitted', async () => {
+ test('should call formSubmitHandler with correct values when submitted', async () => {
renderComponent();
await userEvent.type(
diff --git a/superset-frontend/packages/superset-ui-core/src/components/Radio/Radio.test.tsx b/superset-frontend/packages/superset-ui-core/src/components/Radio/Radio.test.tsx
index 2601ba95f15..46e9465ce36 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/Radio/Radio.test.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/components/Radio/Radio.test.tsx
@@ -21,7 +21,7 @@ import '@testing-library/jest-dom';
import { Radio } from '.';
describe('Radio Component', () => {
- it('renders radio button and allows selection', () => {
+ test('renders radio button and allows selection', () => {
render(
Option 1
diff --git a/superset-frontend/packages/superset-ui-core/src/components/Select/Select.test.tsx b/superset-frontend/packages/superset-ui-core/src/components/Select/Select.test.tsx
index e0383d82558..45656928757 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/Select/Select.test.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/components/Select/Select.test.tsx
@@ -1091,7 +1091,7 @@ describe('grouped options search', () => {
},
];
- it('searches within grouped options and shows matching groups', async () => {
+ test('searches within grouped options and shows matching groups', async () => {
render();
await open();
@@ -1105,7 +1105,7 @@ describe('grouped options search', () => {
expect(screen.queryByText('Female')).not.toBeInTheDocument();
});
- it('shows multiple groups when search matches both', async () => {
+ test('shows multiple groups when search matches both', async () => {
render();
await open();
@@ -1118,7 +1118,7 @@ describe('grouped options search', () => {
expect(await findSelectOption('Her')).toBeInTheDocument();
});
- it('handles case-insensitive search in grouped options', async () => {
+ test('handles case-insensitive search in grouped options', async () => {
render();
await open();
@@ -1129,7 +1129,7 @@ describe('grouped options search', () => {
expect(screen.queryByText('Male')).not.toBeInTheDocument();
});
- it('shows no options when search matches nothing in any group', async () => {
+ test('shows no options when search matches nothing in any group', async () => {
render();
await open();
@@ -1142,7 +1142,7 @@ describe('grouped options search', () => {
).toBeInTheDocument();
});
- it('works in multiple selection mode with grouped options', async () => {
+ test('works in multiple selection mode with grouped options', async () => {
render(
,
);
@@ -1164,7 +1164,7 @@ describe('grouped options search', () => {
expect(values[1]).toHaveTextContent('Emma');
});
- it('preserves group structure when not searching', async () => {
+ test('preserves group structure when not searching', async () => {
render();
await open();
@@ -1174,7 +1174,7 @@ describe('grouped options search', () => {
expect(await findSelectOption('Emma')).toBeInTheDocument();
});
- it('handles empty groups gracefully', async () => {
+ test('handles empty groups gracefully', async () => {
const optionsWithEmptyGroup = [
...GROUPED_OPTIONS,
{
diff --git a/superset-frontend/packages/superset-ui-core/src/components/Skeleton/Skeleton.test.tsx b/superset-frontend/packages/superset-ui-core/src/components/Skeleton/Skeleton.test.tsx
index f36778c1085..df8808f1af2 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/Skeleton/Skeleton.test.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/components/Skeleton/Skeleton.test.tsx
@@ -21,20 +21,20 @@ import '@testing-library/jest-dom';
import { Skeleton } from '.';
describe('Skeleton Component', () => {
- it('renders skeleton', () => {
+ test('renders skeleton', () => {
render();
expect(screen.getByRole('list')).toHaveClass('ant-skeleton-paragraph');
});
- it('renders skeleton with correct number of paragraph rows', () => {
+ test('renders skeleton with correct number of paragraph rows', () => {
render();
const paragraph = screen.getByRole('list');
expect(paragraph.children.length).toBe(3);
});
- it('does not render skeleton when loading is false', () => {
+ test('does not render skeleton when loading is false', () => {
render(
Loaded Content
diff --git a/superset-frontend/packages/superset-ui-core/src/components/Tabs/Tabs.test.tsx b/superset-frontend/packages/superset-ui-core/src/components/Tabs/Tabs.test.tsx
index 9a8a33d4de2..d4ffb017c0c 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/Tabs/Tabs.test.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/components/Tabs/Tabs.test.tsx
@@ -40,7 +40,7 @@ const defaultItems = [
describe('Tabs', () => {
describe('Basic Tabs', () => {
- it('should render tabs with default props', () => {
+ test('should render tabs with default props', () => {
const { getByText, container } = render();
expect(getByText('Tab 1')).toBeInTheDocument();
@@ -57,7 +57,7 @@ describe('Tabs', () => {
).toBeDefined();
});
- it('should render tabs component structure', () => {
+ test('should render tabs component structure', () => {
const { container } = render();
const tabsElement = container.querySelector('.ant-tabs');
const tabsNav = container.querySelector('.ant-tabs-nav');
@@ -68,7 +68,7 @@ describe('Tabs', () => {
expect(tabsContent).toBeDefined();
});
- it('should apply default tabBarStyle with padding', () => {
+ test('should apply default tabBarStyle with padding', () => {
const { container } = render();
const tabsNav = container.querySelector('.ant-tabs-nav') as HTMLElement;
@@ -76,7 +76,7 @@ describe('Tabs', () => {
expect(tabsNav?.style?.paddingLeft).toBeDefined();
});
- it('should merge custom tabBarStyle with defaults', () => {
+ test('should merge custom tabBarStyle with defaults', () => {
const customStyle = { paddingRight: '20px', backgroundColor: 'red' };
const { container } = render(
,
@@ -88,7 +88,7 @@ describe('Tabs', () => {
expect(tabsNav?.style?.backgroundColor).toBe('red');
});
- it('should handle allowOverflow prop', () => {
+ test('should handle allowOverflow prop', () => {
const { container: allowContainer } = render(
,
);
@@ -100,14 +100,14 @@ describe('Tabs', () => {
expect(disallowContainer.querySelector('.ant-tabs')).toBeDefined();
});
- it('should disable animation by default', () => {
+ test('should disable animation by default', () => {
const { container } = render();
const tabsElement = container.querySelector('.ant-tabs');
expect(tabsElement?.className).not.toContain('ant-tabs-animated');
});
- it('should handle tab change events', () => {
+ test('should handle tab change events', () => {
const onChangeMock = jest.fn();
const { getByText } = render(
,
@@ -118,7 +118,7 @@ describe('Tabs', () => {
expect(onChangeMock).toHaveBeenCalledWith('2');
});
- it('should pass through additional props to Antd Tabs', () => {
+ test('should pass through additional props to Antd Tabs', () => {
const onTabClickMock = jest.fn();
const { getByText } = render(
{
});
describe('EditableTabs', () => {
- it('should render with editable features', () => {
+ test('should render with editable features', () => {
const { container } = render();
const tabsElement = container.querySelector('.ant-tabs');
@@ -145,7 +145,7 @@ describe('Tabs', () => {
expect(tabsElement?.className).toContain('ant-tabs-editable-card');
});
- it('should handle onEdit callback for add/remove actions', () => {
+ test('should handle onEdit callback for add/remove actions', () => {
const onEditMock = jest.fn();
const itemsWithRemove = defaultItems.map(item => ({
...item,
@@ -163,7 +163,7 @@ describe('Tabs', () => {
expect(onEditMock).toHaveBeenCalledWith(expect.any(String), 'remove');
});
- it('should have default props set correctly', () => {
+ test('should have default props set correctly', () => {
expect(EditableTabs.defaultProps?.type).toBe('editable-card');
expect(EditableTabs.defaultProps?.animated).toEqual({
inkBar: true,
@@ -173,7 +173,7 @@ describe('Tabs', () => {
});
describe('LineEditableTabs', () => {
- it('should render as line-style editable tabs', () => {
+ test('should render as line-style editable tabs', () => {
const { container } = render();
const tabsElement = container.querySelector('.ant-tabs');
@@ -182,7 +182,7 @@ describe('Tabs', () => {
expect(tabsElement?.className).toContain('ant-tabs-editable-card');
});
- it('should render with line-specific styling', () => {
+ test('should render with line-specific styling', () => {
const { container } = render();
const inkBar = container.querySelector('.ant-tabs-ink-bar');
@@ -191,13 +191,13 @@ describe('Tabs', () => {
});
describe('TabPane Legacy Support', () => {
- it('should support TabPane component access', () => {
+ test('should support TabPane component access', () => {
expect(Tabs.TabPane).toBeDefined();
expect(EditableTabs.TabPane).toBeDefined();
expect(LineEditableTabs.TabPane).toBeDefined();
});
- it('should render using legacy TabPane syntax', () => {
+ test('should render using legacy TabPane syntax', () => {
const { getByText, container } = render(
@@ -222,21 +222,21 @@ describe('Tabs', () => {
});
describe('Edge Cases', () => {
- it('should handle empty items array', () => {
+ test('should handle empty items array', () => {
const { container } = render();
const tabsElement = container.querySelector('.ant-tabs');
expect(tabsElement).toBeDefined();
});
- it('should handle undefined items', () => {
+ test('should handle undefined items', () => {
const { container } = render();
const tabsElement = container.querySelector('.ant-tabs');
expect(tabsElement).toBeDefined();
});
- it('should handle tabs with no content', () => {
+ test('should handle tabs with no content', () => {
const itemsWithoutContent = [
{ key: '1', label: 'Tab 1' },
{ key: '2', label: 'Tab 2' },
@@ -248,14 +248,14 @@ describe('Tabs', () => {
expect(getByText('Tab 2')).toBeInTheDocument();
});
- it('should handle allowOverflow default value', () => {
+ test('should handle allowOverflow default value', () => {
const { container } = render();
expect(container.querySelector('.ant-tabs')).toBeDefined();
});
});
describe('Accessibility', () => {
- it('should render with proper ARIA roles', () => {
+ test('should render with proper ARIA roles', () => {
const { container } = render();
const tablist = container.querySelector('[role="tablist"]');
@@ -265,7 +265,7 @@ describe('Tabs', () => {
expect(tabs.length).toBe(3);
});
- it('should support keyboard navigation', () => {
+ test('should support keyboard navigation', () => {
const { container, getByText } = render();
const firstTab = container.querySelector('[role="tab"]');
@@ -282,7 +282,7 @@ describe('Tabs', () => {
});
describe('Styling Integration', () => {
- it('should accept and apply custom CSS classes', () => {
+ test('should accept and apply custom CSS classes', () => {
const { container } = render(
// eslint-disable-next-line react/forbid-component-props
,
@@ -293,7 +293,7 @@ describe('Tabs', () => {
expect(tabsElement?.className).toContain('custom-tabs-class');
});
- it('should accept and apply custom styles', () => {
+ test('should accept and apply custom styles', () => {
const customStyle = { minHeight: '200px' };
const { container } = render(
// eslint-disable-next-line react/forbid-component-props
diff --git a/superset-frontend/packages/superset-ui-core/src/components/Timer/Timer.test.tsx b/superset-frontend/packages/superset-ui-core/src/components/Timer/Timer.test.tsx
index 95baebd9020..902acb9192f 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/Timer/Timer.test.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/components/Timer/Timer.test.tsx
@@ -38,7 +38,7 @@ describe('Timer', () => {
status: 'warning',
};
- it('should render correctly', async () => {
+ test('should render correctly', async () => {
const screen = render();
const node = screen.getByRole('timer');
let text = node.textContent || '';
diff --git a/superset-frontend/packages/superset-ui-core/src/components/Tree/Tree.test.tsx b/superset-frontend/packages/superset-ui-core/src/components/Tree/Tree.test.tsx
index 1075bb53b65..e20feba0062 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/Tree/Tree.test.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/components/Tree/Tree.test.tsx
@@ -32,7 +32,7 @@ const treeData = [
];
describe('Tree Component', () => {
- it('expands and collapses parent node', async () => {
+ test('expands and collapses parent node', async () => {
render();
expect(screen.queryByText('Child 1')).not.toBeInTheDocument();
diff --git a/superset-frontend/packages/superset-ui-core/src/components/TreeSelect/TreeSelect.test.tsx b/superset-frontend/packages/superset-ui-core/src/components/TreeSelect/TreeSelect.test.tsx
index 86077691abe..985093cb1aa 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/TreeSelect/TreeSelect.test.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/components/TreeSelect/TreeSelect.test.tsx
@@ -48,7 +48,7 @@ const treeData = [
];
describe('TreeSelect Component', () => {
- it('should render TreeSelect correctly', () => {
+ test('should render TreeSelect correctly', () => {
render(
{
- it('renders Text component', () => {
+ test('renders Text component', () => {
render(Text Content);
expect(screen.getByText('Text Content')).toBeInTheDocument();
});
- it('renders Title component', () => {
+ test('renders Title component', () => {
render(Title Content);
expect(screen.getByText('Title Content')).toBeInTheDocument();
expect(screen.getByRole('heading', { level: 2 })).toBeInTheDocument();
});
- it('renders Paragraph component', () => {
+ test('renders Paragraph component', () => {
render(Paragraph Content);
expect(screen.getByText('Paragraph Content')).toBeInTheDocument();
});
- it('renders Link component', () => {
+ test('renders Link component', () => {
render(
Link Content
@@ -48,19 +48,19 @@ describe('Typography Component', () => {
expect(link).toHaveAttribute('href', 'https://example.com');
});
- it('renders strong text', () => {
+ test('renders strong text', () => {
render(Strong Text);
expect(screen.getByText('Strong Text')).toHaveStyle('font-weight: 600');
});
- it('renders underlined text', () => {
+ test('renders underlined text', () => {
render(Underlined Text);
expect(screen.getByText('Underlined Text')).toHaveStyle(
'text-decoration: underline',
);
});
- it('renders disabled text', () => {
+ test('renders disabled text', () => {
render(Disabled Text);
expect(screen.getByText('Disabled Text')).toHaveClass(
'ant-typography-disabled',
diff --git a/superset-frontend/packages/superset-ui-core/src/components/Upload/Upload.test.tsx b/superset-frontend/packages/superset-ui-core/src/components/Upload/Upload.test.tsx
index fb0f08ed666..8c51069932a 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/Upload/Upload.test.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/components/Upload/Upload.test.tsx
@@ -20,7 +20,7 @@ import { render, screen, fireEvent, waitFor } from '@superset-ui/core/spec';
import { Button, Upload } from '..';
describe('Upload Component', () => {
- it('renders upload button and triggers file upload', async () => {
+ test('renders upload button and triggers file upload', async () => {
const handleChange = jest.fn();
render(
diff --git a/superset-frontend/packages/superset-ui-core/src/utils/dates.test.ts b/superset-frontend/packages/superset-ui-core/src/utils/dates.test.ts
index 7395bcb5884..1efa61c775d 100644
--- a/superset-frontend/packages/superset-ui-core/src/utils/dates.test.ts
+++ b/superset-frontend/packages/superset-ui-core/src/utils/dates.test.ts
@@ -26,7 +26,7 @@ import {
} from './dates';
describe('extendedDayjs', () => {
- it('returns dayjs object with extended methods', () => {
+ test('returns dayjs object with extended methods', () => {
const dayjs = extendedDayjs();
expect(dayjs).toHaveProperty('utc');
expect(dayjs).toHaveProperty('calendar');
@@ -44,58 +44,58 @@ describe('extendedDayjs', () => {
});
describe('fDuration', () => {
- it('is a function', () => {
+ test('is a function', () => {
expect(typeof fDuration).toBe('function');
});
- it('returns a string', () => {
+ test('returns a string', () => {
expect(typeof fDuration(new Date().getTime(), new Date().getTime())).toBe(
'string',
);
});
- it('returns the expected output', () => {
+ test('returns the expected output', () => {
const output = fDuration(1496293608897, 1496293623406);
expect(output).toBe('00:00:14.509');
});
});
describe('now', () => {
- it('is a function', () => {
+ test('is a function', () => {
expect(typeof now).toBe('function');
});
- it('returns a number', () => {
+ test('returns a number', () => {
expect(typeof now()).toBe('number');
});
});
describe('epochTimeXHoursAgo', () => {
- it('is a function', () => {
+ test('is a function', () => {
expect(typeof epochTimeXHoursAgo).toBe('function');
});
- it('returns a number', () => {
+ test('returns a number', () => {
expect(typeof epochTimeXHoursAgo(1)).toBe('number');
});
});
describe('epochTimeXDaysAgo', () => {
- it('is a function', () => {
+ test('is a function', () => {
expect(typeof epochTimeXDaysAgo).toBe('function');
});
- it('returns a number', () => {
+ test('returns a number', () => {
expect(typeof epochTimeXDaysAgo(1)).toBe('number');
});
});
describe('epochTimeXYearsAgo', () => {
- it('is a function', () => {
+ test('is a function', () => {
expect(typeof epochTimeXYearsAgo).toBe('function');
});
- it('returns a number', () => {
+ test('returns a number', () => {
expect(typeof epochTimeXYearsAgo(1)).toBe('number');
});
});
diff --git a/superset-frontend/packages/superset-ui-core/src/utils/html.test.tsx b/superset-frontend/packages/superset-ui-core/src/utils/html.test.tsx
index 6dd4e279f0d..648b2b68ce7 100644
--- a/superset-frontend/packages/superset-ui-core/src/utils/html.test.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/utils/html.test.tsx
@@ -28,7 +28,7 @@ import {
} from './html';
describe('sanitizeHtml', () => {
- it('should sanitize the HTML string', () => {
+ test('should sanitize the HTML string', () => {
const htmlString = '';
const sanitizedString = sanitizeHtml(htmlString);
expect(sanitizedString).not.toContain('script');
@@ -36,13 +36,13 @@ describe('sanitizeHtml', () => {
});
describe('isProbablyHTML', () => {
- it('should return true if the text contains HTML tags', () => {
+ test('should return true if the text contains HTML tags', () => {
const htmlText = 'Some HTML content
';
const isHTML = isProbablyHTML(htmlText);
expect(isHTML).toBe(true);
});
- it('should return false if the text does not contain HTML tags', () => {
+ test('should return false if the text does not contain HTML tags', () => {
const plainText = 'Just a plain text';
const isHTML = isProbablyHTML(plainText);
expect(isHTML).toBe(false);
@@ -51,7 +51,7 @@ describe('isProbablyHTML', () => {
expect(isProbablyHTML(trickyText)).toBe(false);
});
- it('should return false for strings with angle brackets that are not HTML', () => {
+ test('should return false for strings with angle brackets that are not HTML', () => {
// Test case from issue #25561
expect(isProbablyHTML('')).toBe(false);
@@ -66,7 +66,7 @@ describe('isProbablyHTML', () => {
expect(isProbablyHTML('price < $100')).toBe(false);
});
- it('should return true for all known HTML tags', () => {
+ test('should return true for all known HTML tags', () => {
expect(isProbablyHTML('')).toBe(true);
expect(isProbablyHTML('Content')).toBe(true);
expect(isProbablyHTML('')).toBe(true);
@@ -86,13 +86,13 @@ describe('isProbablyHTML', () => {
});
describe('sanitizeHtmlIfNeeded', () => {
- it('should sanitize the HTML string if it contains HTML tags', () => {
+ test('should sanitize the HTML string if it contains HTML tags', () => {
const htmlString = 'Some HTML content
';
const sanitizedString = sanitizeHtmlIfNeeded(htmlString);
expect(sanitizedString).toEqual(htmlString);
});
- it('should return the string as is if it does not contain HTML tags', () => {
+ test('should return the string as is if it does not contain HTML tags', () => {
const plainText = 'Just a plain text';
const sanitizedString = sanitizeHtmlIfNeeded(plainText);
expect(sanitizedString).toEqual(plainText);
@@ -100,7 +100,7 @@ describe('sanitizeHtmlIfNeeded', () => {
});
describe('safeHtmlSpan', () => {
- it('should return a safe HTML span when the input is HTML', () => {
+ test('should return a safe HTML span when the input is HTML', () => {
const htmlString = 'Some HTML content
';
const safeSpan = safeHtmlSpan(htmlString);
expect(safeSpan).toEqual(
@@ -111,7 +111,7 @@ describe('safeHtmlSpan', () => {
);
});
- it('should return the input string as is when it is not HTML', () => {
+ test('should return the input string as is when it is not HTML', () => {
const plainText = 'Just a plain text';
const result = safeHtmlSpan(plainText);
expect(result).toEqual(plainText);
@@ -119,31 +119,31 @@ describe('safeHtmlSpan', () => {
});
describe('removeHTMLTags', () => {
- it('should remove HTML tags from the string', () => {
+ test('should remove HTML tags from the string', () => {
const input = 'Hello, World!
';
const output = removeHTMLTags(input);
expect(output).toBe('Hello, World!');
});
- it('should return the same string when no HTML tags are present', () => {
+ test('should return the same string when no HTML tags are present', () => {
const input = 'This is a plain text.';
const output = removeHTMLTags(input);
expect(output).toBe('This is a plain text.');
});
- it('should remove nested HTML tags and return combined text content', () => {
+ test('should remove nested HTML tags and return combined text content', () => {
const input = '';
const output = removeHTMLTags(input);
expect(output).toBe('TitleContent');
});
- it('should handle self-closing tags and return an empty string', () => {
+ test('should handle self-closing tags and return an empty string', () => {
const input = '
';
const output = removeHTMLTags(input);
expect(output).toBe('');
});
- it('should handle malformed HTML tags and remove only well-formed tags', () => {
+ test('should handle malformed HTML tags and remove only well-formed tags', () => {
const input = 'Unclosed tag';
const output = removeHTMLTags(input);
expect(output).toBe('Unclosed tag');
@@ -151,44 +151,44 @@ describe('removeHTMLTags', () => {
});
describe('isJsonString', () => {
- it('valid JSON object', () => {
+ test('valid JSON object', () => {
const jsonString = '{"name": "John", "age": 30, "city": "New York"}';
expect(isJsonString(jsonString)).toBe(true);
});
- it('valid JSON array', () => {
+ test('valid JSON array', () => {
const jsonString = '[1, 2, 3, 4, 5]';
expect(isJsonString(jsonString)).toBe(true);
});
- it('valid JSON string', () => {
+ test('valid JSON string', () => {
const jsonString = '"Hello, world!"';
expect(isJsonString(jsonString)).toBe(true);
});
- it('invalid JSON with syntax error', () => {
+ test('invalid JSON with syntax error', () => {
const jsonString = '{"name": "John", "age": 30, "city": "New York"';
expect(isJsonString(jsonString)).toBe(false);
});
- it('empty string', () => {
+ test('empty string', () => {
const jsonString = '';
expect(isJsonString(jsonString)).toBe(false);
});
- it('non-JSON string', () => {
+ test('non-JSON string', () => {
const jsonString = '
Hello, World!
';
expect(isJsonString(jsonString)).toBe(false);
});
- it('non-JSON formatted number', () => {
+ test('non-JSON formatted number', () => {
const jsonString = '12345abc';
expect(isJsonString(jsonString)).toBe(false);
});
});
describe('getParagraphContents', () => {
- it('should return an object with keys for each paragraph tag', () => {
+ test('should return an object with keys for each paragraph tag', () => {
const htmlString =
'
First paragraph.
Second paragraph.
';
const result = getParagraphContents(htmlString);
@@ -198,23 +198,23 @@ describe('getParagraphContents', () => {
});
});
- it('should return null if the string is not HTML', () => {
+ test('should return null if the string is not HTML', () => {
const nonHtmlString = 'Just a plain text string.';
expect(getParagraphContents(nonHtmlString)).toBeNull();
});
- it('should return null if there are no
tags in the HTML string', () => {
+ test('should return null if there are no
tags in the HTML string', () => {
const htmlStringWithoutP = '
No paragraph here.
';
expect(getParagraphContents(htmlStringWithoutP)).toBeNull();
});
- it('should return an object with empty string for empty
tag', () => {
+ test('should return an object with empty string for empty
tag', () => {
const htmlStringWithEmptyP = '
';
const result = getParagraphContents(htmlStringWithEmptyP);
expect(result).toEqual({ p1: '' });
});
- it('should handle HTML strings with nested
tags correctly', () => {
+ test('should handle HTML strings with nested
tags correctly', () => {
const htmlStringWithNestedP =
'
First paragraph with nested content.
';
const result = getParagraphContents(htmlStringWithNestedP);
@@ -225,31 +225,31 @@ describe('getParagraphContents', () => {
});
describe('extractTextFromHTML', () => {
- it('should extract text from HTML div tags', () => {
+ test('should extract text from HTML div tags', () => {
const htmlString = '
Hello World
';
const result = extractTextFromHTML(htmlString);
expect(result).toBe('Hello World');
});
- it('should extract text from nested HTML tags', () => {
+ test('should extract text from nested HTML tags', () => {
const htmlString = '
';
const result = extractTextFromHTML(htmlString);
expect(result).toBe('Hello World');
});
- it('should extract text from multiple HTML elements', () => {
+ test('should extract text from multiple HTML elements', () => {
const htmlString = '
Title
Content
Footer';
const result = extractTextFromHTML(htmlString);
expect(result).toBe('TitleContentFooter');
});
- it('should return original string when input is not HTML', () => {
+ test('should return original string when input is not HTML', () => {
const plainText = 'Just plain text';
const result = extractTextFromHTML(plainText);
expect(result).toBe('Just plain text');
});
- it('should return original value when input is not a string', () => {
+ test('should return original value when input is not a string', () => {
const numberValue = 12345;
const result = extractTextFromHTML(numberValue);
expect(result).toBe(12345);
@@ -263,31 +263,31 @@ describe('extractTextFromHTML', () => {
expect(booleanResult).toBe(true);
});
- it('should handle empty HTML tags', () => {
+ test('should handle empty HTML tags', () => {
const htmlString = '
';
const result = extractTextFromHTML(htmlString);
expect(result).toBe('');
});
- it('should handle HTML with only whitespace', () => {
+ test('should handle HTML with only whitespace', () => {
const htmlString = '
';
const result = extractTextFromHTML(htmlString);
expect(result).toBe(' ');
});
- it('should extract text from HTML with attributes', () => {
+ test('should extract text from HTML with attributes', () => {
const htmlString = '
Hello World
';
const result = extractTextFromHTML(htmlString);
expect(result).toBe('Hello World');
});
- it('should handle self-closing tags', () => {
+ test('should handle self-closing tags', () => {
const htmlString = '

Text after
';
const result = extractTextFromHTML(htmlString);
expect(result).toBe('Text after');
});
- it('should handle complex HTML structure', () => {
+ test('should handle complex HTML structure', () => {
const htmlString = `
Page Title
@@ -311,7 +311,7 @@ describe('extractTextFromHTML', () => {
expect(result).toContain('Item 2');
});
- it('should not extract text from strings that look like HTML but are not', () => {
+ test('should not extract text from strings that look like HTML but are not', () => {
const fakeHtmlString = '
';
const result = extractTextFromHTML(fakeHtmlString);
expect(result).toBe('');
diff --git a/superset-frontend/packages/superset-ui-core/src/utils/merge.test.ts b/superset-frontend/packages/superset-ui-core/src/utils/merge.test.ts
index 73a27f53648..04e68f4e05b 100644
--- a/superset-frontend/packages/superset-ui-core/src/utils/merge.test.ts
+++ b/superset-frontend/packages/superset-ui-core/src/utils/merge.test.ts
@@ -21,7 +21,7 @@ import { mergeReplaceArrays } from './merge';
describe('lodash utilities', () => {
describe('mergeReplaceArrays', () => {
- it('should merge objects and replace arrays', () => {
+ test('should merge objects and replace arrays', () => {
const obj1 = { a: [1, 2], b: { c: 3 } };
const obj2 = { a: [4, 5], b: { d: 6 } };
@@ -33,7 +33,7 @@ describe('lodash utilities', () => {
});
});
- it('should handle precedence with multiple sources', () => {
+ test('should handle precedence with multiple sources', () => {
const base = { x: { y: 1 }, z: [1] };
const override1 = { x: { y: 2 }, z: [2, 3] };
const override2 = { x: { y: 3 }, z: [4] };
@@ -46,7 +46,7 @@ describe('lodash utilities', () => {
});
});
- it('should handle empty and null values', () => {
+ test('should handle empty and null values', () => {
const base = { a: [1], b: { x: 1 } };
const override = { a: [], b: { x: null } };
diff --git a/superset-frontend/packages/superset-ui-core/test/chart-composition/legend/WithLegend.test.tsx b/superset-frontend/packages/superset-ui-core/test/chart-composition/legend/WithLegend.test.tsx
index f4d5ab8e290..4338d372e41 100644
--- a/superset-frontend/packages/superset-ui-core/test/chart-composition/legend/WithLegend.test.tsx
+++ b/superset-frontend/packages/superset-ui-core/test/chart-composition/legend/WithLegend.test.tsx
@@ -25,13 +25,14 @@ let renderChart = jest.fn();
let renderLegend = jest.fn();
// TODO: rewrite to rtl
+/* oxlint-disable-next-line jest/no-disabled-tests */
describe.skip('WithLegend', () => {
beforeEach(() => {
renderChart = jest.fn(() => );
renderLegend = jest.fn(() => );
});
- it('sets className', () => {
+ test('sets className', () => {
const { container } = render(
{
expect(container.querySelectorAll('.test-class')).toHaveLength(1);
});
- it('renders when renderLegend is not set', () => {
+ test('renders when renderLegend is not set', () => {
const { container } = render(
{
}, 100);
});
- it('renders', () => {
+ test('renders', () => {
const { container } = render(
{
}, 100);
});
- it('renders without width or height', () => {
+ test('renders without width or height', () => {
const { container } = render(
{
}, 100);
});
- it('renders legend on the left', () => {
+ test('renders legend on the left', () => {
const { container } = render(
{
}, 100);
});
- it('renders legend on the right', () => {
+ test('renders legend on the right', () => {
const { container } = render(
{
}, 100);
});
- it('renders legend on the top', () => {
+ test('renders legend on the top', () => {
const { container } = render(
{
}, 100);
});
- it('renders legend on the bottom', () => {
+ test('renders legend on the bottom', () => {
const { container } = render(
{
}, 100);
});
- it('renders legend with justifyContent set', () => {
+ test('renders legend with justifyContent set', () => {
const { container } = render(
{
- it('sets className', () => {
+ test('sets className', () => {
const { container } = render(
Hi!
@@ -32,7 +32,7 @@ describe('TooltipFrame', () => {
expect(container.querySelector('.test-class')).toBeInTheDocument();
});
- it('renders', () => {
+ test('renders', () => {
const { container } = render(
Hi!
diff --git a/superset-frontend/packages/superset-ui-core/test/chart-composition/tooltip/TooltipTable.test.tsx b/superset-frontend/packages/superset-ui-core/test/chart-composition/tooltip/TooltipTable.test.tsx
index c27cb44f4c5..555207747d5 100644
--- a/superset-frontend/packages/superset-ui-core/test/chart-composition/tooltip/TooltipTable.test.tsx
+++ b/superset-frontend/packages/superset-ui-core/test/chart-composition/tooltip/TooltipTable.test.tsx
@@ -23,14 +23,14 @@ import { TooltipTable } from '@superset-ui/core';
import { CSSProperties } from 'react';
describe('TooltipTable', () => {
- it('sets className', () => {
+ test('sets className', () => {
const { container } = render(
,
);
expect(container.querySelector('.test-class')).toBeInTheDocument();
});
- it('renders empty table', () => {
+ test('renders empty table', () => {
render();
const table = screen.getByRole('table');
expect(table).toBeInTheDocument();
@@ -39,7 +39,7 @@ describe('TooltipTable', () => {
expect(rows[0]).toHaveTextContent(/No Data|empty/i);
});
- it('renders table with content', async () => {
+ test('renders table with content', async () => {
const data = [
{
key: 'Cersei',
diff --git a/superset-frontend/packages/superset-ui-core/test/chart/clients/ChartClient.test.ts b/superset-frontend/packages/superset-ui-core/test/chart/clients/ChartClient.test.ts
index 17182227323..f1b69b96de8 100644
--- a/superset-frontend/packages/superset-ui-core/test/chart/clients/ChartClient.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/chart/clients/ChartClient.test.ts
@@ -56,10 +56,10 @@ describe('ChartClient', () => {
afterEach(() => fetchMock.removeRoutes().clearHistory());
describe('new ChartClient(config)', () => {
- it('creates a client without argument', () => {
+ test('creates a client without argument', () => {
expect(chartClient).toBeInstanceOf(ChartClient);
});
- it('creates a client with specified config.client', () => {
+ test('creates a client with specified config.client', () => {
const customClient = new SupersetClientClass();
chartClient = new ChartClient({ client: customClient });
expect(chartClient).toBeInstanceOf(ChartClient);
@@ -69,7 +69,7 @@ describe('ChartClient', () => {
describe('.loadFormData({ sliceId, formData }, options)', () => {
const sliceId = 123;
- it('fetches formData if given only sliceId', () => {
+ test('fetches formData if given only sliceId', () => {
fetchMock.get(
`glob:*/api/v1/form_data/?slice_id=${sliceId}`,
sankeyFormData,
@@ -79,7 +79,7 @@ describe('ChartClient', () => {
sankeyFormData,
);
});
- it('fetches formData from sliceId and merges with specify formData if both fields are specified', () => {
+ test('fetches formData from sliceId and merges with specify formData if both fields are specified', () => {
fetchMock.get(
`glob:*/api/v1/form_data/?slice_id=${sliceId}`,
sankeyFormData,
@@ -99,7 +99,7 @@ describe('ChartClient', () => {
viz_type: VizType.Bar,
});
});
- it('returns promise of formData if only formData was given', () =>
+ test('returns promise of formData if only formData was given', () =>
expect(
chartClient.loadFormData({
formData: {
@@ -113,7 +113,7 @@ describe('ChartClient', () => {
granularity: 'minute',
viz_type: VizType.Line,
}));
- it('rejects if none of sliceId or formData is specified', () =>
+ test('rejects if none of sliceId or formData is specified', () =>
expect(
chartClient.loadFormData({} as SliceIdAndOrFormData),
).rejects.toEqual(
@@ -122,7 +122,7 @@ describe('ChartClient', () => {
});
describe('.loadQueryData(formData, options)', () => {
- it('returns a promise of query data for known chart type', () => {
+ test('returns a promise of query data for known chart type', () => {
getChartMetadataRegistry().registerValue(
VizType.WordCloud,
new ChartMetadata({ name: 'Word Cloud', thumbnail: '' }),
@@ -152,7 +152,7 @@ describe('ChartClient', () => {
},
]);
});
- it('returns a promise that rejects for unknown chart type', () =>
+ test('returns a promise that rejects for unknown chart type', () =>
expect(
chartClient.loadQueryData({
granularity: 'minute',
@@ -161,7 +161,7 @@ describe('ChartClient', () => {
}),
).rejects.toEqual(new Error('Unknown chart type: rainbow_3d_pie')));
- it('fetches data from the legacy API if ChartMetadata has useLegacyApi=true,', () => {
+ test('fetches data from the legacy API if ChartMetadata has useLegacyApi=true,', () => {
// note legacy charts do not register a buildQuery function in the registry
getChartMetadataRegistry().registerValue(
'word_cloud_legacy',
@@ -197,7 +197,7 @@ describe('ChartClient', () => {
});
describe('.loadDatasource(datasourceKey, options)', () => {
- it('fetches datasource', () => {
+ test('fetches datasource', () => {
fetchMock.get(
'glob:*/superset/fetch_datasource_metadata?datasourceKey=1__table',
{
@@ -214,13 +214,13 @@ describe('ChartClient', () => {
});
describe('.loadAnnotation(annotationLayer)', () => {
- it('returns an empty object if the annotation layer does not require query', () =>
+ test('returns an empty object if the annotation layer does not require query', () =>
expect(
chartClient.loadAnnotation({
name: 'my-annotation',
}),
).resolves.toEqual({}));
- it('otherwise returns a rejected promise because it is not implemented yet', () =>
+ test('otherwise returns a rejected promise because it is not implemented yet', () =>
expect(
chartClient.loadAnnotation({
name: 'my-annotation',
@@ -230,7 +230,7 @@ describe('ChartClient', () => {
});
describe('.loadAnnotations(annotationLayers)', () => {
- it('loads multiple annotation layers and combine results', () =>
+ test('loads multiple annotation layers and combine results', () =>
expect(
chartClient.loadAnnotations([
{
@@ -248,15 +248,15 @@ describe('ChartClient', () => {
anno2: {},
anno3: {},
}));
- it('returns an empty object if input is not an array', () =>
+ test('returns an empty object if input is not an array', () =>
expect(chartClient.loadAnnotations()).resolves.toEqual({}));
- it('returns an empty object if input is an empty array', () =>
+ test('returns an empty object if input is an empty array', () =>
expect(chartClient.loadAnnotations()).resolves.toEqual({}));
});
describe('.loadChartData({ sliceId, formData })', () => {
const sliceId = 10120;
- it('loadAllDataNecessaryForAChart', () => {
+ test('loadAllDataNecessaryForAChart', () => {
fetchMock.get(`glob:*/api/v1/form_data/?slice_id=${sliceId}`, {
granularity: 'minute',
viz_type: VizType.Line,
diff --git a/superset-frontend/packages/superset-ui-core/test/chart/components/ChartDataProvider.test.tsx b/superset-frontend/packages/superset-ui-core/test/chart/components/ChartDataProvider.test.tsx
index 5cda5acdd8b..3745c0b746d 100644
--- a/superset-frontend/packages/superset-ui-core/test/chart/components/ChartDataProvider.test.tsx
+++ b/superset-frontend/packages/superset-ui-core/test/chart/components/ChartDataProvider.test.tsx
@@ -81,13 +81,13 @@ describe('ChartDataProvider', () => {
return render();
}
- it('instantiates a new ChartClient()', () => {
+ test('instantiates a new ChartClient()', () => {
setup();
expect(ChartClientMock).toHaveBeenCalledTimes(1);
});
describe('ChartClient.loadFormData', () => {
- it('calls method on mount', () => {
+ test('calls method on mount', () => {
setup();
expect(mockLoadFormData).toHaveBeenCalledTimes(1);
expect(mockLoadFormData.mock.calls[0][0]).toEqual({
@@ -96,14 +96,14 @@ describe('ChartDataProvider', () => {
});
});
- it('should pass formDataRequestOptions to ChartClient.loadFormData', () => {
+ test('should pass formDataRequestOptions to ChartClient.loadFormData', () => {
const options = { host: 'override' };
setup({ formDataRequestOptions: options });
expect(mockLoadFormData).toHaveBeenCalledTimes(1);
expect(mockLoadFormData.mock.calls[0][1]).toEqual(options);
});
- it('calls ChartClient.loadFormData when formData or sliceId change', async () => {
+ test('calls ChartClient.loadFormData when formData or sliceId change', async () => {
const { rerender } = setup();
const newProps = { sliceId: 123, formData: undefined };
expect(mockLoadFormData).toHaveBeenCalledTimes(1);
@@ -115,7 +115,7 @@ describe('ChartDataProvider', () => {
});
describe('ChartClient.loadDatasource', () => {
- it('does not call method if loadDatasource is false', async () => {
+ test('does not call method if loadDatasource is false', async () => {
setup({ loadDatasource: false });
await act(async () => {
await new Promise(resolve => setTimeout(resolve, 0));
@@ -123,7 +123,7 @@ describe('ChartDataProvider', () => {
expect(mockLoadDatasource).not.toHaveBeenCalled();
});
- it('calls method on mount if loadDatasource is true', async () => {
+ test('calls method on mount if loadDatasource is true', async () => {
setup({ loadDatasource: true });
await act(async () => {
await new Promise(resolve => setTimeout(resolve, 0));
@@ -135,7 +135,7 @@ describe('ChartDataProvider', () => {
]);
});
- it('should pass datasourceRequestOptions to ChartClient.loadDatasource', async () => {
+ test('should pass datasourceRequestOptions to ChartClient.loadDatasource', async () => {
const options = { host: 'override' };
setup({ loadDatasource: true, datasourceRequestOptions: options });
await act(async () => {
@@ -145,7 +145,7 @@ describe('ChartDataProvider', () => {
expect(mockLoadDatasource.mock.calls[0][1]).toEqual(options);
});
- it('calls ChartClient.loadDatasource if loadDatasource is true and formData or sliceId change', async () => {
+ test('calls ChartClient.loadDatasource if loadDatasource is true and formData or sliceId change', async () => {
const { rerender } = setup({ loadDatasource: true });
const newDatasource = 'test';
@@ -177,7 +177,7 @@ describe('ChartDataProvider', () => {
});
describe('ChartClient.loadQueryData', () => {
- it('calls method on mount', async () => {
+ test('calls method on mount', async () => {
setup();
await act(async () => {
await new Promise(resolve => setTimeout(resolve, 0));
@@ -189,7 +189,7 @@ describe('ChartDataProvider', () => {
]);
});
- it('should pass queryDataRequestOptions to ChartClient.loadQueryData', async () => {
+ test('should pass queryDataRequestOptions to ChartClient.loadQueryData', async () => {
const options = { host: 'override' };
setup({ queryRequestOptions: options });
await act(async () => {
@@ -202,7 +202,7 @@ describe('ChartDataProvider', () => {
);
});
- it('calls ChartClient.loadQueryData when formData or sliceId change', async () => {
+ test('calls ChartClient.loadQueryData when formData or sliceId change', async () => {
const { rerender } = setup();
const newFormData = { key: 'test' };
@@ -225,7 +225,7 @@ describe('ChartDataProvider', () => {
});
describe('children', () => {
- it('shows loading state initially', async () => {
+ test('shows loading state initially', async () => {
mockLoadFormData.mockImplementation(() => new Promise(() => {}));
mockLoadQueryData.mockImplementation(() => new Promise(() => {}));
mockLoadDatasource.mockImplementation(() => new Promise(() => {}));
@@ -234,7 +234,7 @@ describe('ChartDataProvider', () => {
await screen.findByRole('status');
});
- it('shows payload when loaded', async () => {
+ test('shows payload when loaded', async () => {
mockLoadFormData.mockResolvedValue(props.formData);
mockLoadQueryData.mockResolvedValue([props.formData]);
mockLoadDatasource.mockResolvedValue(props.formData.datasource);
@@ -251,7 +251,7 @@ describe('ChartDataProvider', () => {
});
});
- it('shows error message upon request error', async () => {
+ test('shows error message upon request error', async () => {
const errorMessage = 'error';
mockLoadFormData.mockRejectedValue(new Error(errorMessage));
@@ -262,7 +262,7 @@ describe('ChartDataProvider', () => {
expect(errorElement).toHaveTextContent(errorMessage);
});
- it('shows error message upon JS error', async () => {
+ test('shows error message upon JS error', async () => {
mockLoadFormData.mockImplementation(() => {
throw new Error('non-async error');
});
@@ -276,7 +276,7 @@ describe('ChartDataProvider', () => {
});
describe('callbacks', () => {
- it('calls onLoaded when loaded', async () => {
+ test('calls onLoaded when loaded', async () => {
const onLoaded = jest.fn();
mockLoadFormData.mockResolvedValue(props.formData);
mockLoadQueryData.mockResolvedValue([props.formData]);
@@ -296,7 +296,7 @@ describe('ChartDataProvider', () => {
});
});
- it('calls onError upon request error', async () => {
+ test('calls onError upon request error', async () => {
const onError = jest.fn();
mockLoadFormData.mockRejectedValue(new Error('error'));
@@ -310,7 +310,7 @@ describe('ChartDataProvider', () => {
expect(onError).toHaveBeenCalledWith(new Error('error'));
});
- it('calls onError upon JS error', async () => {
+ test('calls onError upon JS error', async () => {
const onError = jest.fn();
mockLoadFormData.mockImplementation(() => {
throw new Error('non-async error');
diff --git a/superset-frontend/packages/superset-ui-core/test/chart/components/SuperChart.test.tsx b/superset-frontend/packages/superset-ui-core/test/chart/components/SuperChart.test.tsx
index a739748d2ee..db41f084cb5 100644
--- a/superset-frontend/packages/superset-ui-core/test/chart/components/SuperChart.test.tsx
+++ b/superset-frontend/packages/superset-ui-core/test/chart/components/SuperChart.test.tsx
@@ -105,12 +105,12 @@ describe('SuperChart', () => {
window.removeEventListener('error', onError);
});
- it('should have correct number of errors', () => {
+ test('should have correct number of errors', () => {
expect(actualErrors).toBe(expectedErrors);
expectedErrors = 0;
});
- it('renders default FallbackComponent', async () => {
+ test('renders default FallbackComponent', async () => {
expectedErrors = 1;
render(
{
).toBeInTheDocument();
});
- it('renders custom FallbackComponent', async () => {
+ test('renders custom FallbackComponent', async () => {
expectedErrors = 1;
const CustomFallbackComponent = jest.fn(() => (
Custom Fallback!
@@ -145,7 +145,7 @@ describe('SuperChart', () => {
expect(await screen.findByText('Custom Fallback!')).toBeInTheDocument();
expect(CustomFallbackComponent).toHaveBeenCalledTimes(1);
});
- it('call onErrorBoundary', async () => {
+ test('call onErrorBoundary', async () => {
expectedErrors = 1;
const handleError = jest.fn();
render(
@@ -163,7 +163,7 @@ describe('SuperChart', () => {
});
// Update the test cases
- it('does not include ErrorBoundary if told so', async () => {
+ test('does not include ErrorBoundary if told so', async () => {
expectedErrors = 1;
const inactiveErrorHandler = jest.fn();
const activeErrorHandler = jest.fn();
@@ -198,7 +198,7 @@ describe('SuperChart', () => {
jest.setTimeout(10000);
// Update the props test to wait for component to render
- it('passes the props to renderer correctly', async () => {
+ test('passes the props to renderer correctly', async () => {
const { container } = render(
{
};
// Update the resize observer trigger to ensure it's called after component mount
- it.skip('works when width and height are percent', async () => {
+ /* oxlint-disable-next-line jest/no-disabled-tests */
+ test.skip('works when width and height are percent', async () => {
const { container } = render(
{
await waitForDimensions(container, 300, 300);
});
- it('passes the props with multiple queries to renderer correctly', async () => {
+ test('passes the props with multiple queries to renderer correctly', async () => {
const { container } = render(
{
});
describe('supports NoResultsComponent', () => {
- it('renders NoResultsComponent when queriesData is missing', () => {
+ test('renders NoResultsComponent when queriesData is missing', () => {
render(
,
);
@@ -352,7 +353,7 @@ describe('SuperChart', () => {
expect(screen.getByText('No Results')).toBeInTheDocument();
});
- it('renders NoResultsComponent when queriesData data is null', () => {
+ test('renders NoResultsComponent when queriesData data is null', () => {
render(
{
);
}
- it('works with width and height that are numbers', async () => {
+ test('works with width and height that are numbers', async () => {
const { container } = render(
{
});
});
- it.skip('works when width and height are percent', async () => {
+ /* oxlint-disable-next-line jest/no-disabled-tests */
+ test.skip('works when width and height are percent', async () => {
const wrapper = createSizedWrapper();
document.body.appendChild(wrapper);
@@ -457,7 +459,7 @@ describe('SuperChart', () => {
}, 30000);
});
- it('should render MatrixifyGridRenderer when matrixify is enabled with empty data', () => {
+ test('should render MatrixifyGridRenderer when matrixify is enabled with empty data', () => {
const mockIsMatrixifyEnabled = isMatrixifyEnabled as jest.MockedFunction<
typeof isMatrixifyEnabled
>;
@@ -482,7 +484,7 @@ describe('SuperChart', () => {
expect(screen.queryByText('No Results')).not.toBeInTheDocument();
});
- it('should render MatrixifyGridRenderer when matrixify is enabled with null data', () => {
+ test('should render MatrixifyGridRenderer when matrixify is enabled with null data', () => {
const mockIsMatrixifyEnabled = isMatrixifyEnabled as jest.MockedFunction<
typeof isMatrixifyEnabled
>;
@@ -507,7 +509,7 @@ describe('SuperChart', () => {
expect(screen.queryByText('No Results')).not.toBeInTheDocument();
});
- it('should ignore custom noResults component when matrixify is enabled', () => {
+ test('should ignore custom noResults component when matrixify is enabled', () => {
const mockIsMatrixifyEnabled = isMatrixifyEnabled as jest.MockedFunction<
typeof isMatrixifyEnabled
>;
@@ -537,7 +539,7 @@ describe('SuperChart', () => {
).not.toBeInTheDocument();
});
- it('should apply error boundary to matrixify grid renderer', () => {
+ test('should apply error boundary to matrixify grid renderer', () => {
const mockIsMatrixifyEnabled = isMatrixifyEnabled as jest.MockedFunction<
typeof isMatrixifyEnabled
>;
diff --git a/superset-frontend/packages/superset-ui-core/test/chart/components/SuperChartCore.test.tsx b/superset-frontend/packages/superset-ui-core/test/chart/components/SuperChartCore.test.tsx
index ba07a9eb829..e053f3c393d 100644
--- a/superset-frontend/packages/superset-ui-core/test/chart/components/SuperChartCore.test.tsx
+++ b/superset-frontend/packages/superset-ui-core/test/chart/components/SuperChartCore.test.tsx
@@ -62,7 +62,7 @@ describe('SuperChartCore', () => {
});
describe('registered charts', () => {
- it('renders registered chart', async () => {
+ test('renders registered chart', async () => {
const { container } = render(
{
});
});
- it('renders registered chart with lazy loading', async () => {
+ test('renders registered chart with lazy loading', async () => {
const { container } = render(
,
);
@@ -85,7 +85,7 @@ describe('SuperChartCore', () => {
});
});
- it('does not render if chartType is not set', async () => {
+ test('does not render if chartType is not set', async () => {
// @ts-expect-error chartType is required
const { container } = render();
@@ -95,7 +95,7 @@ describe('SuperChartCore', () => {
});
});
- it('adds id to container if specified', async () => {
+ test('adds id to container if specified', async () => {
const { container } = render(
,
);
@@ -107,7 +107,7 @@ describe('SuperChartCore', () => {
});
});
- it('adds class to container if specified', async () => {
+ test('adds class to container if specified', async () => {
const { container } = render(
,
);
@@ -119,7 +119,7 @@ describe('SuperChartCore', () => {
});
});
- it('uses overrideTransformProps when specified', async () => {
+ test('uses overrideTransformProps when specified', async () => {
render(
{
});
});
- it('uses preTransformProps when specified', async () => {
+ test('uses preTransformProps when specified', async () => {
const chartPropsWithPayload = new ChartProps({
queriesData: [{ message: 'hulk' }],
theme: supersetTheme,
@@ -151,7 +151,7 @@ describe('SuperChartCore', () => {
});
});
- it('uses postTransformProps when specified', async () => {
+ test('uses postTransformProps when specified', async () => {
render(
{
});
});
- it('renders if chartProps is not specified', async () => {
+ test('renders if chartProps is not specified', async () => {
const { container } = render(
,
);
@@ -174,7 +174,7 @@ describe('SuperChartCore', () => {
});
});
- it('does not render anything while waiting for Chart code to load', () => {
+ test('does not render anything while waiting for Chart code to load', () => {
const { container } = render(
,
);
@@ -183,7 +183,7 @@ describe('SuperChartCore', () => {
expect(testComponent).not.toBeInTheDocument();
});
- it('eventually renders after Chart is loaded', async () => {
+ test('eventually renders after Chart is loaded', async () => {
const { container } = render(
,
);
@@ -198,7 +198,7 @@ describe('SuperChartCore', () => {
);
});
- it('does not render if chartProps is null', async () => {
+ test('does not render if chartProps is null', async () => {
const { container } = render(
,
);
@@ -216,7 +216,7 @@ describe('SuperChartCore', () => {
});
describe('unregistered charts', () => {
- it('renders error message', async () => {
+ test('renders error message', async () => {
render(
,
);
@@ -228,7 +228,7 @@ describe('SuperChartCore', () => {
});
describe('.processChartProps()', () => {
- it('use identity functions for unspecified transforms', () => {
+ test('use identity functions for unspecified transforms', () => {
const chart = new SuperChartCore({
chartType: ChartKeys.DILIGENT,
});
diff --git a/superset-frontend/packages/superset-ui-core/test/chart/components/createLoadableRenderer.test.tsx b/superset-frontend/packages/superset-ui-core/test/chart/components/createLoadableRenderer.test.tsx
index 5fe263589e8..60b11730b03 100644
--- a/superset-frontend/packages/superset-ui-core/test/chart/components/createLoadableRenderer.test.tsx
+++ b/superset-frontend/packages/superset-ui-core/test/chart/components/createLoadableRenderer.test.tsx
@@ -59,13 +59,13 @@ describe('createLoadableRenderer', () => {
});
describe('returns a LoadableRenderer class', () => {
- it('LoadableRenderer.preload() preloads the lazy-load components', () => {
+ test('LoadableRenderer.preload() preloads the lazy-load components', () => {
expect(LoadableRenderer.preload).toBeInstanceOf(Function);
LoadableRenderer.preload();
expect(loadChartSuccess).toHaveBeenCalledTimes(1);
});
- it('calls onRenderSuccess when succeeds', async () => {
+ test('calls onRenderSuccess when succeeds', async () => {
const onRenderSuccess = jest.fn();
const onRenderFailure = jest.fn();
renderTestComponent(
@@ -82,7 +82,7 @@ describe('createLoadableRenderer', () => {
expect(onRenderFailure).not.toHaveBeenCalled();
});
- it('calls onRenderFailure when fails', () =>
+ test('calls onRenderFailure when fails', () =>
new Promise(done => {
const loadChartFailure = jest.fn(() =>
Promise.reject(new Error('Invalid chart')),
@@ -111,7 +111,7 @@ describe('createLoadableRenderer', () => {
}, 10);
}));
- it('onRenderFailure is optional', () =>
+ test('onRenderFailure is optional', () =>
new Promise(done => {
const loadChartFailure = jest.fn(() =>
Promise.reject(new Error('Invalid chart')),
@@ -131,7 +131,7 @@ describe('createLoadableRenderer', () => {
}, 10);
}));
- it('renders the lazy-load components', () =>
+ test('renders the lazy-load components', () =>
new Promise(done => {
renderTestComponent();
// lazy-loaded component not rendered immediately
@@ -143,7 +143,7 @@ describe('createLoadableRenderer', () => {
}, 10);
}));
- it('does not throw if loaders are empty', () => {
+ test('does not throw if loaders are empty', () => {
const NeverLoadingRenderer = createLoadableRenderer({
loader: {},
loading,
diff --git a/superset-frontend/packages/superset-ui-core/test/chart/components/reactify.test.tsx b/superset-frontend/packages/superset-ui-core/test/chart/components/reactify.test.tsx
index 44c62e90e9f..b64e1989411 100644
--- a/superset-frontend/packages/superset-ui-core/test/chart/components/reactify.test.tsx
+++ b/superset-frontend/packages/superset-ui-core/test/chart/components/reactify.test.tsx
@@ -77,7 +77,7 @@ describe('reactify(renderFn)', () => {
}
}
- it('returns a React component class', () =>
+ test('returns a React component class', () =>
new Promise(done => {
render();
@@ -95,45 +95,45 @@ describe('reactify(renderFn)', () => {
}, 20);
}));
describe('displayName', () => {
- it('has displayName if renderFn.displayName is defined', () => {
+ test('has displayName if renderFn.displayName is defined', () => {
expect(TheChart.displayName).toEqual('BoldText');
});
- it('does not have displayName if renderFn.displayName is not defined', () => {
+ test('does not have displayName if renderFn.displayName is not defined', () => {
const AnotherChart = reactify(() => {});
expect(AnotherChart.displayName).toBeUndefined();
});
});
describe('propTypes', () => {
- it('has propTypes if renderFn.propTypes is defined', () => {
+ test('has propTypes if renderFn.propTypes is defined', () => {
/* eslint-disable-next-line react/forbid-foreign-prop-types */
expect(Object.keys(TheChart.propTypes ?? {})).toEqual(['content']);
});
- it('does not have propTypes if renderFn.propTypes is not defined', () => {
+ test('does not have propTypes if renderFn.propTypes is not defined', () => {
const AnotherChart = reactify(() => {});
/* eslint-disable-next-line react/forbid-foreign-prop-types */
expect(Object.keys(AnotherChart.propTypes ?? {})).toEqual([]);
});
});
describe('defaultProps', () => {
- it('has defaultProps if renderFn.defaultProps is defined', () => {
+ test('has defaultProps if renderFn.defaultProps is defined', () => {
expect(TheChart.defaultProps).toBe(renderFn.defaultProps);
render();
expect(screen.getByText('ghi')).toBeInTheDocument();
expect(screen.getByText('ghi').parentNode).toHaveAttribute('id', 'test');
});
- it('does not have defaultProps if renderFn.defaultProps is not defined', () => {
+ test('does not have defaultProps if renderFn.defaultProps is not defined', () => {
const AnotherChart = reactify(() => {});
expect(AnotherChart.defaultProps).toBeUndefined();
});
});
- it('does not try to render if not mounted', () => {
+ test('does not try to render if not mounted', () => {
const anotherRenderFn = jest.fn();
const AnotherChart = reactify(anotherRenderFn); // enables valid new AnotherChart() call
// @ts-expect-error
new AnotherChart({ id: 'test' }).execute();
expect(anotherRenderFn).not.toHaveBeenCalled();
});
- it('calls willUnmount hook when it is provided', () =>
+ test('calls willUnmount hook when it is provided', () =>
new Promise(done => {
const { unmount } = render();
setTimeout(() => {
diff --git a/superset-frontend/packages/superset-ui-core/test/chart/index.test.ts b/superset-frontend/packages/superset-ui-core/test/chart/index.test.ts
index 45d1902a533..fd8838e5561 100644
--- a/superset-frontend/packages/superset-ui-core/test/chart/index.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/chart/index.test.ts
@@ -32,7 +32,7 @@ import {
} from '@superset-ui/core';
describe('index', () => {
- it('exports modules', () => {
+ test('exports modules', () => {
[
ChartClient,
ChartMetadata,
diff --git a/superset-frontend/packages/superset-ui-core/test/chart/models/ChartMetadata.test.ts b/superset-frontend/packages/superset-ui-core/test/chart/models/ChartMetadata.test.ts
index 636e4170a1b..e7d40bb1073 100644
--- a/superset-frontend/packages/superset-ui-core/test/chart/models/ChartMetadata.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/chart/models/ChartMetadata.test.ts
@@ -20,11 +20,11 @@
import { ChartMetadata } from '@superset-ui/core';
describe('ChartMetadata', () => {
- it('exists', () => {
+ test('exists', () => {
expect(ChartMetadata).toBeDefined();
});
describe('new ChartMetadata({})', () => {
- it('creates new metadata instance', () => {
+ test('creates new metadata instance', () => {
const metadata = new ChartMetadata({
name: 'test chart',
credits: [],
@@ -42,10 +42,10 @@ describe('ChartMetadata', () => {
description: 'some kind of chart',
thumbnail: 'test.png',
});
- it('returns true if can', () => {
+ test('returns true if can', () => {
expect(metadata.canBeAnnotationType('event')).toBeTruthy();
});
- it('returns false otherwise', () => {
+ test('returns false otherwise', () => {
expect(metadata.canBeAnnotationType('invalid-type')).toBeFalsy();
});
});
@@ -59,10 +59,10 @@ describe('ChartMetadata', () => {
});
const clone = metadata.clone();
- it('returns a new instance', () => {
+ test('returns a new instance', () => {
expect(metadata).not.toBe(clone);
});
- it('returns a new instance with same field values', () => {
+ test('returns a new instance with same field values', () => {
expect(metadata.name).toEqual(clone.name);
expect(metadata.credits).toEqual(clone.credits);
expect(metadata.description).toEqual(clone.description);
diff --git a/superset-frontend/packages/superset-ui-core/test/chart/models/ChartPlugin.test.tsx b/superset-frontend/packages/superset-ui-core/test/chart/models/ChartPlugin.test.tsx
index 7805322ea75..41a455a734b 100644
--- a/superset-frontend/packages/superset-ui-core/test/chart/models/ChartPlugin.test.tsx
+++ b/superset-frontend/packages/superset-ui-core/test/chart/models/ChartPlugin.test.tsx
@@ -52,7 +52,7 @@ describe('ChartPlugin', () => {
const controlPanel = { abc: 1 };
- it('exists', () => {
+ test('exists', () => {
expect(ChartPlugin).toBeDefined();
});
@@ -63,7 +63,7 @@ describe('ChartPlugin', () => {
viz_type: VizType.Table,
};
- it('creates a new plugin', () => {
+ test('creates a new plugin', () => {
const plugin = new ChartPlugin({
metadata,
Chart: FakeChart,
@@ -71,14 +71,14 @@ describe('ChartPlugin', () => {
expect(plugin).toBeInstanceOf(ChartPlugin);
});
describe('buildQuery', () => {
- it('defaults to undefined', () => {
+ test('defaults to undefined', () => {
const plugin = new ChartPlugin({
metadata,
Chart: FakeChart,
});
expect(plugin.loadBuildQuery).toBeUndefined();
});
- it('uses loadBuildQuery field if specified', () => {
+ test('uses loadBuildQuery field if specified', () => {
expect.assertions(2);
const plugin = new ChartPlugin({
metadata,
@@ -91,7 +91,7 @@ describe('ChartPlugin', () => {
expect(fn(FORM_DATA).queries[0]).toEqual({ granularity: 'day' });
expect(fn(FORM_DATA).force).toEqual(false);
});
- it('uses buildQuery field if specified', () => {
+ test('uses buildQuery field if specified', () => {
expect.assertions(1);
const plugin = new ChartPlugin({
metadata,
@@ -105,7 +105,7 @@ describe('ChartPlugin', () => {
});
});
describe('Chart', () => {
- it('uses loadChart if specified', () => {
+ test('uses loadChart if specified', () => {
const loadChart = () => FakeChart;
const plugin = new ChartPlugin({
metadata,
@@ -114,14 +114,14 @@ describe('ChartPlugin', () => {
// the loader is sanitized, so assert on the value
expect(plugin.loadChart()).toBe(loadChart());
});
- it('uses Chart field if specified', () => {
+ test('uses Chart field if specified', () => {
const plugin = new ChartPlugin({
metadata,
Chart: FakeChart,
});
expect(plugin.loadChart()).toEqual(FakeChart);
});
- it('throws an error if none of Chart or loadChart is specified', () => {
+ test('throws an error if none of Chart or loadChart is specified', () => {
expect(() => new ChartPlugin({ metadata })).toThrow(Error);
});
});
@@ -133,7 +133,7 @@ describe('ChartPlugin', () => {
queriesData: [{}],
theme: supersetTheme,
});
- it('defaults to identity function', () => {
+ test('defaults to identity function', () => {
const plugin = new ChartPlugin({
metadata,
Chart: FakeChart,
@@ -141,7 +141,7 @@ describe('ChartPlugin', () => {
const fn = plugin.loadTransformProps() as TransformProps;
expect(fn(PROPS)).toBe(PROPS);
});
- it('uses loadTransformProps field if specified', () => {
+ test('uses loadTransformProps field if specified', () => {
const plugin = new ChartPlugin({
metadata,
Chart: FakeChart,
@@ -150,7 +150,7 @@ describe('ChartPlugin', () => {
const fn = plugin.loadTransformProps() as TransformProps;
expect(fn(PROPS)).toEqual({ field2: 2 });
});
- it('uses transformProps field if specified', () => {
+ test('uses transformProps field if specified', () => {
const plugin = new ChartPlugin({
metadata,
Chart: FakeChart,
@@ -161,7 +161,7 @@ describe('ChartPlugin', () => {
});
});
describe('controlPanel', () => {
- it('takes controlPanel from input', () => {
+ test('takes controlPanel from input', () => {
const plugin = new ChartPlugin({
metadata,
Chart: FakeChart,
@@ -169,7 +169,7 @@ describe('ChartPlugin', () => {
});
expect(plugin.controlPanel).toBe(controlPanel);
});
- it('defaults to empty object', () => {
+ test('defaults to empty object', () => {
const plugin = new ChartPlugin({
metadata,
Chart: FakeChart,
@@ -191,13 +191,13 @@ describe('ChartPlugin', () => {
});
});
- it('throws an error if key is not provided', () => {
+ test('throws an error if key is not provided', () => {
expect(() => plugin.register()).toThrow(Error);
expect(() => plugin.configure({ key: 'ab' }).register()).not.toThrow(
Error,
);
});
- it('add the plugin to the registries', () => {
+ test('add the plugin to the registries', () => {
plugin.configure({ key: 'cd' }).register();
expect(getChartMetadataRegistry().get('cd')).toBe(metadata);
expect(getChartComponentRegistry().get('cd')).toBe(FakeChart);
@@ -205,7 +205,7 @@ describe('ChartPlugin', () => {
expect(getChartBuildQueryRegistry().get('cd')).toBe(buildQuery);
expect(getChartControlPanelRegistry().get('cd')).toBe(controlPanel);
});
- it('does not register buildQuery when it is not specified in the ChartPlugin', () => {
+ test('does not register buildQuery when it is not specified in the ChartPlugin', () => {
new ChartPlugin({
metadata,
Chart: FakeChart,
@@ -214,7 +214,7 @@ describe('ChartPlugin', () => {
.register();
expect(getChartBuildQueryRegistry().has('ef')).toEqual(false);
});
- it('returns itself', () => {
+ test('returns itself', () => {
expect(plugin.configure({ key: 'gh' }).register()).toBe(plugin);
});
});
@@ -231,13 +231,13 @@ describe('ChartPlugin', () => {
});
});
- it('throws an error if key is not provided', () => {
+ test('throws an error if key is not provided', () => {
expect(() => plugin.unregister()).toThrow(Error);
expect(() => plugin.configure({ key: 'abc' }).unregister()).not.toThrow(
Error,
);
});
- it('removes the chart from the registries', () => {
+ test('removes the chart from the registries', () => {
plugin.configure({ key: 'def' }).register();
expect(getChartMetadataRegistry().get('def')).toBe(metadata);
expect(getChartComponentRegistry().get('def')).toBe(FakeChart);
@@ -251,7 +251,7 @@ describe('ChartPlugin', () => {
expect(getChartBuildQueryRegistry().has('def')).toBeFalsy();
expect(getChartControlPanelRegistry().has('def')).toBeFalsy();
});
- it('returns itself', () => {
+ test('returns itself', () => {
expect(plugin.configure({ key: 'xyz' }).unregister()).toBe(plugin);
});
});
diff --git a/superset-frontend/packages/superset-ui-core/test/chart/models/ChartProps.test.ts b/superset-frontend/packages/superset-ui-core/test/chart/models/ChartProps.test.ts
index c9301b56f66..232d40c93a0 100644
--- a/superset-frontend/packages/superset-ui-core/test/chart/models/ChartProps.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/chart/models/ChartProps.test.ts
@@ -33,11 +33,11 @@ const QUERIES_DATA = [QUERY_DATA];
const BEHAVIORS = [Behavior.NativeFilter, Behavior.InteractiveChart];
describe('ChartProps', () => {
- it('exists', () => {
+ test('exists', () => {
expect(ChartProps).toBeDefined();
});
describe('new ChartProps({})', () => {
- it('returns new instance', () => {
+ test('returns new instance', () => {
const props = new ChartProps({
width: 800,
height: 600,
@@ -47,7 +47,7 @@ describe('ChartProps', () => {
});
expect(props).toBeInstanceOf(ChartProps);
});
- it('processes formData and datasource to convert field names to camelCase', () => {
+ test('processes formData and datasource to convert field names to camelCase', () => {
const props = new ChartProps({
width: 800,
height: 600,
@@ -66,10 +66,10 @@ describe('ChartProps', () => {
});
describe('ChartProps.createSelector()', () => {
const selector = ChartProps.createSelector();
- it('returns a selector function', () => {
+ test('returns a selector function', () => {
expect(selector).toBeInstanceOf(Function);
});
- it('selector returns previous chartProps if all input fields do not change', () => {
+ test('selector returns previous chartProps if all input fields do not change', () => {
const props1 = selector({
width: 800,
height: 600,
@@ -92,7 +92,7 @@ describe('ChartProps', () => {
});
expect(props1).toBe(props2);
});
- it('selector returns a new chartProps if the 13th field changes', () => {
+ test('selector returns a new chartProps if the 13th field changes', () => {
/** this test is here to test for selectors that exceed 12 arguments (
* isRefreshing is the 13th argument, which is missing TS declarations).
* See: https://github.com/reduxjs/reselect/issues/378
@@ -120,7 +120,7 @@ describe('ChartProps', () => {
});
expect(props1).not.toBe(props2);
});
- it('selector returns a new chartProps if some input fields change and returns memoized chart props', () => {
+ test('selector returns a new chartProps if some input fields change and returns memoized chart props', () => {
const props1 = selector({
width: 800,
height: 600,
diff --git a/superset-frontend/packages/superset-ui-core/test/color/CategoricalColorNameSpace.test.ts b/superset-frontend/packages/superset-ui-core/test/color/CategoricalColorNameSpace.test.ts
index 014be254864..8ae41774296 100644
--- a/superset-frontend/packages/superset-ui-core/test/color/CategoricalColorNameSpace.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/color/CategoricalColorNameSpace.test.ts
@@ -47,21 +47,21 @@ describe('CategoricalColorNamespace', () => {
}),
);
});
- it('The class constructor cannot be accessed directly', () => {
+ test('The class constructor cannot be accessed directly', () => {
expect(typeof CategoricalColorNamespace).not.toBe('Function');
});
describe('static getNamespace()', () => {
- it('returns default namespace if name is not specified', () => {
+ test('returns default namespace if name is not specified', () => {
const namespace = getNamespace();
expect(namespace !== undefined).toBe(true);
expect(namespace.name).toBe(DEFAULT_NAMESPACE);
});
- it('returns namespace with specified name', () => {
+ test('returns namespace with specified name', () => {
const namespace = getNamespace('myNamespace');
expect(namespace !== undefined).toBe(true);
expect(namespace.name).toBe('myNamespace');
});
- it('returns existing instance if the name already exists', () => {
+ test('returns existing instance if the name already exists', () => {
const ns1 = getNamespace('myNamespace');
const ns2 = getNamespace('myNamespace');
expect(ns1).toBe(ns2);
@@ -71,13 +71,13 @@ describe('CategoricalColorNamespace', () => {
});
});
describe('.getScale()', () => {
- it('returns a CategoricalColorScale from given scheme name', () => {
+ test('returns a CategoricalColorScale from given scheme name', () => {
const namespace = getNamespace('test-get-scale1');
const scale = namespace.getScale('testColors');
expect(scale).toBeDefined();
expect(scale.getColor('dog')).toBeDefined();
});
- it('returns a scale when a schemeId is not specified and there is no default key', () => {
+ test('returns a scale when a schemeId is not specified and there is no default key', () => {
getCategoricalSchemeRegistry().clearDefaultKey();
const namespace = getNamespace('new-space');
const scale = namespace.getScale();
@@ -86,14 +86,14 @@ describe('CategoricalColorNamespace', () => {
});
});
describe('.setColor()', () => {
- it('overwrites color for all CategoricalColorScales in this namespace', () => {
+ test('overwrites color for all CategoricalColorScales in this namespace', () => {
const namespace = getNamespace('test-set-scale1');
namespace.setColor('dog', 'black');
const scale = namespace.getScale('testColors');
expect(scale.getColor('dog')).toBe('black');
expect(scale.getColor('boy')).not.toBe('black');
});
- it('can override forcedColors in each scale', () => {
+ test('can override forcedColors in each scale', () => {
const namespace = getNamespace('test-set-scale2');
namespace.setColor('dog', 'black');
const scale = namespace.getScale('testColors');
@@ -101,7 +101,7 @@ describe('CategoricalColorNamespace', () => {
expect(scale.getColor('dog')).toBe('pink');
expect(scale.getColor('boy')).not.toBe('black');
});
- it('does not affect scales in other namespaces', () => {
+ test('does not affect scales in other namespaces', () => {
const ns1 = getNamespace('test-set-scale3.1');
ns1.setColor('dog', 'black');
const scale1 = ns1.getScale('testColors');
@@ -110,12 +110,12 @@ describe('CategoricalColorNamespace', () => {
expect(scale1.getColor('dog')).toBe('black');
expect(scale2.getColor('dog')).not.toBe('black');
});
- it('returns the namespace instance', () => {
+ test('returns the namespace instance', () => {
const ns1 = getNamespace('test-set-scale3.1');
const ns2 = ns1.setColor('dog', 'black');
expect(ns1).toBe(ns2);
});
- it('should reset colors', () => {
+ test('should reset colors', () => {
const ns1 = getNamespace('test-set-scale3.1');
ns1.setColor('dog', 'black');
ns1.resetColors();
@@ -123,36 +123,36 @@ describe('CategoricalColorNamespace', () => {
});
});
describe('static getScale()', () => {
- it('getScale() returns a CategoricalColorScale with default scheme in default namespace', () => {
+ test('getScale() returns a CategoricalColorScale with default scheme in default namespace', () => {
const scale = getScale();
expect(scale).toBeDefined();
const scale2 = getNamespace().getScale();
expect(scale2).toBeDefined();
});
- it('getScale(scheme) returns a CategoricalColorScale with specified scheme in default namespace', () => {
+ test('getScale(scheme) returns a CategoricalColorScale with specified scheme in default namespace', () => {
const scale = getNamespace().getScale('testColors');
expect(scale).toBeDefined();
});
- it('getScale(scheme, namespace) returns a CategoricalColorScale with specified scheme in specified namespace', () => {
+ test('getScale(scheme, namespace) returns a CategoricalColorScale with specified scheme in specified namespace', () => {
const scale = getNamespace('test-getScale').getScale('testColors');
expect(scale).toBeDefined();
});
});
describe('static getColor()', () => {
- it('getColor(value) returns a color from default scheme in default namespace', () => {
+ test('getColor(value) returns a color from default scheme in default namespace', () => {
const value = 'dog';
const color = getColor(value);
const color2 = getNamespace().getScale().getColor(value);
expect(color).toBe(color2);
});
- it('getColor(value, scheme) returns a color from specified scheme in default namespace', () => {
+ test('getColor(value, scheme) returns a color from specified scheme in default namespace', () => {
const value = 'dog';
const scheme = 'testColors';
const color = getColor(value, scheme);
const color2 = getNamespace().getScale(scheme).getColor(value);
expect(color).toBe(color2);
});
- it('getColor(value, scheme, namespace) returns a color from specified scheme in specified namespace', () => {
+ test('getColor(value, scheme, namespace) returns a color from specified scheme in specified namespace', () => {
const value = 'dog';
const scheme = 'testColors';
const namespace = 'test-getColor';
@@ -162,7 +162,7 @@ describe('CategoricalColorNamespace', () => {
});
});
describe('statis resetColorsForLabels(labels)', () => {
- it('removes specified labels from forcedItems', () => {
+ test('removes specified labels from forcedItems', () => {
const namespace = getNamespace('test-reset-individual');
namespace.setColor('label1', 'red');
namespace.setColor('label2', 'blue');
@@ -170,7 +170,7 @@ describe('CategoricalColorNamespace', () => {
expect(namespace.forcedItems).toMatchObject({ label2: 'blue' });
});
- it('does not modify forcedItems if no labels are provided', () => {
+ test('does not modify forcedItems if no labels are provided', () => {
const namespace = getNamespace('test-reset-individual');
namespace.setColor('label1', 'red');
namespace.setColor('label2', 'blue');
@@ -181,14 +181,14 @@ describe('CategoricalColorNamespace', () => {
label2: 'blue',
});
});
- it('does nothing if the label is not in forcedItems', () => {
+ test('does nothing if the label is not in forcedItems', () => {
const namespace = getNamespace('test-reset-individual');
namespace.setColor('label1', 'red');
namespace.resetColorsForLabels(['label2']); // label2 doesn't exist
expect(namespace.forcedItems).toMatchObject({ label1: 'red' });
});
- it('removes all labels when all are provided', () => {
+ test('removes all labels when all are provided', () => {
const namespace = getNamespace('test-reset-individual');
namespace.setColor('label1', 'red');
namespace.setColor('label2', 'blue');
@@ -196,7 +196,7 @@ describe('CategoricalColorNamespace', () => {
expect(namespace.forcedItems).toMatchObject({});
});
- it('creates a deep copy of forcedItems before modifying', () => {
+ test('creates a deep copy of forcedItems before modifying', () => {
const namespace = getNamespace('test-reset-individual');
namespace.setColor('label1', 'red');
@@ -205,14 +205,14 @@ describe('CategoricalColorNamespace', () => {
expect(originalForcedItems).not.toBe(namespace.forcedItems);
});
- it('removes the label if it exists in updatedForcedItems', () => {
+ test('removes the label if it exists in updatedForcedItems', () => {
const namespace = getNamespace('test-reset-individual');
namespace.setColor('label1', 'red');
namespace.resetColorsForLabels(['label1']);
expect(namespace.forcedItems).toEqual({});
});
- it('does nothing for a label not in updatedForcedItems', () => {
+ test('does nothing for a label not in updatedForcedItems', () => {
const namespace = getNamespace('test-reset-individual');
namespace.setColor('label1', 'red');
namespace.resetColorsForLabels(['label2']); // label2 doesn't exist
diff --git a/superset-frontend/packages/superset-ui-core/test/color/CategoricalColorScale.test.ts b/superset-frontend/packages/superset-ui-core/test/color/CategoricalColorScale.test.ts
index dbd72881a70..28dfb93abe3 100644
--- a/superset-frontend/packages/superset-ui-core/test/color/CategoricalColorScale.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/color/CategoricalColorScale.test.ts
@@ -29,16 +29,16 @@ describe('CategoricalColorScale', () => {
window.featureFlags = {};
});
- it('exists', () => {
+ test('exists', () => {
expect(CategoricalColorScale !== undefined).toBe(true);
});
describe('new CategoricalColorScale(colors, forcedColors)', () => {
- it('can create new scale when forcedColors is not given', () => {
+ test('can create new scale when forcedColors is not given', () => {
const scale = new CategoricalColorScale(['blue', 'red', 'green']);
expect(scale).toBeInstanceOf(CategoricalColorScale);
});
- it('can create new scale when forcedColors is given', () => {
+ test('can create new scale when forcedColors is given', () => {
const forcedColors = {};
const scale = new CategoricalColorScale(
['blue', 'red', 'green'],
@@ -47,7 +47,7 @@ describe('CategoricalColorScale', () => {
expect(scale).toBeInstanceOf(CategoricalColorScale);
expect(scale.forcedColors).toBe(forcedColors);
});
- it('can refer to colors based on their index', () => {
+ test('can refer to colors based on their index', () => {
const forcedColors = { pig: 1, horse: 5 };
const scale = new CategoricalColorScale(
['blue', 'red', 'green'],
@@ -86,7 +86,7 @@ describe('CategoricalColorScale', () => {
jest.restoreAllMocks();
});
- it('uses labelsColorMapInstance color map when source is Dashboard, otherwise uses chartLabelsColorMap', () => {
+ test('uses labelsColorMapInstance color map when source is Dashboard, otherwise uses chartLabelsColorMap', () => {
const sliceId = 123;
const colorScheme = 'preset';
@@ -116,7 +116,7 @@ describe('CategoricalColorScale', () => {
);
expect(colorFromChart).toBe('chartColor');
});
- it('returns same color for same value', () => {
+ test('returns same color for same value', () => {
const scale = new CategoricalColorScale(['blue', 'red', 'green'], {
pig: 'red',
horse: 'green',
@@ -130,7 +130,7 @@ describe('CategoricalColorScale', () => {
expect(c1).toBe(c3);
expect(c2).toBe(c5);
});
- it('returns different color for consecutive items', () => {
+ test('returns different color for consecutive items', () => {
const scale = new CategoricalColorScale(['blue', 'red', 'green']);
const c1 = scale.getColor('pig');
const c2 = scale.getColor('horse');
@@ -140,7 +140,7 @@ describe('CategoricalColorScale', () => {
expect(c2).not.toBe(c3);
expect(c3).not.toBe(c1);
});
- it('recycles colors when number of items exceed available colors', () => {
+ test('recycles colors when number of items exceed available colors', () => {
const colorSet: { [key: string]: number } = {};
const scale = new CategoricalColorScale(['blue', 'red', 'green']);
const colors = [
@@ -163,7 +163,7 @@ describe('CategoricalColorScale', () => {
expect(colorSet[color]).toBe(2);
});
});
- it('get analogous colors when number of items exceed available colors', () => {
+ test('get analogous colors when number of items exceed available colors', () => {
window.featureFlags = {
[FeatureFlag.UseAnalogousColors]: true,
};
@@ -176,7 +176,7 @@ describe('CategoricalColorScale', () => {
scale.getColor('goat');
expect(scale.range()).toHaveLength(9);
});
- it('adds the color and value to chartLabelsColorMap and calls addSlice', () => {
+ test('adds the color and value to chartLabelsColorMap and calls addSlice', () => {
const value = 'testValue';
const sliceId = 123;
const colorScheme = 'preset';
@@ -199,7 +199,7 @@ describe('CategoricalColorScale', () => {
const returnedColor = scale.getColor(value, sliceId);
expect(returnedColor).toBe(expectedColor);
});
- it('conditionally calls getNextAvailableColor', () => {
+ test('conditionally calls getNextAvailableColor', () => {
window.featureFlags = {
[FeatureFlag.AvoidColorsCollision]: true,
};
@@ -228,12 +228,12 @@ describe('CategoricalColorScale', () => {
});
describe('.setColor(value, forcedColor)', () => {
- it('overrides default color', () => {
+ test('overrides default color', () => {
const scale = new CategoricalColorScale(['blue', 'red', 'green']);
scale.setColor('pig', 'pink');
expect(scale.getColor('pig')).toBe('pink');
});
- it('does override forcedColors', () => {
+ test('does override forcedColors', () => {
const scale1 = new CategoricalColorScale(['blue', 'red', 'green']);
scale1.setColor('pig', 'black');
@@ -242,14 +242,14 @@ describe('CategoricalColorScale', () => {
expect(scale2.getColor('pig')).toBe('pink');
expect(scale1.getColor('pig')).toBe('black');
});
- it('returns the scale', () => {
+ test('returns the scale', () => {
const scale = new CategoricalColorScale(['blue', 'red', 'green']);
const output = scale.setColor('pig', 'pink');
expect(scale).toBe(output);
});
});
describe('.getColorMap()', () => {
- it('returns correct mapping using least used color', () => {
+ test('returns correct mapping using least used color', () => {
const scale1 = new CategoricalColorScale(['blue', 'red', 'green']);
scale1.setColor('cow', 'black');
const scale2 = new CategoricalColorScale(
@@ -269,7 +269,7 @@ describe('CategoricalColorScale', () => {
});
describe('.copy()', () => {
- it('returns a copy', () => {
+ test('returns a copy', () => {
const scale = new CategoricalColorScale(['blue', 'red', 'green']);
const copy = scale.copy();
expect(copy).not.toBe(scale);
@@ -280,35 +280,35 @@ describe('CategoricalColorScale', () => {
});
});
describe('.domain()', () => {
- it('when called without argument, returns domain', () => {
+ test('when called without argument, returns domain', () => {
const scale = new CategoricalColorScale(['blue', 'red', 'green']);
scale.getColor('pig');
expect(scale.domain()).toEqual(['pig']);
});
- it('when called with argument, sets domain', () => {
+ test('when called with argument, sets domain', () => {
const scale = new CategoricalColorScale(['blue', 'red', 'green']);
scale.domain(['dog', 'pig', 'cat']);
expect(scale('pig')).toEqual('red');
});
});
describe('.range()', () => {
- it('when called without argument, returns range', () => {
+ test('when called without argument, returns range', () => {
const scale = new CategoricalColorScale(['blue', 'red', 'green']);
expect(scale.range()).toEqual(['blue', 'red', 'green']);
});
- it('when called with argument, sets range', () => {
+ test('when called with argument, sets range', () => {
const scale = new CategoricalColorScale(['blue', 'red', 'green']);
scale.range(['pink', 'gray', 'yellow']);
expect(scale.range()).toEqual(['pink', 'gray', 'yellow']);
});
});
describe('.unknown()', () => {
- it('when called without argument, returns output for unknown value', () => {
+ test('when called without argument, returns output for unknown value', () => {
const scale = new CategoricalColorScale(['blue', 'red', 'green']);
scale.unknown('#666');
expect(scale.unknown()).toEqual('#666');
});
- it('when called with argument, sets output for unknown value', () => {
+ test('when called with argument, sets output for unknown value', () => {
const scale = new CategoricalColorScale(['blue', 'red', 'green']);
scale.unknown('#222');
expect(scale.unknown()).toEqual('#222');
@@ -316,7 +316,7 @@ describe('CategoricalColorScale', () => {
});
describe('a CategoricalColorScale instance is also a color function itself', () => {
- it('scale(value) returns same color for same value', () => {
+ test('scale(value) returns same color for same value', () => {
const scale = new CategoricalColorScale(['blue', 'red', 'green']);
expect(scale.getColor('pig')).toBe('blue');
expect(scale('pig')).toBe('blue');
@@ -326,7 +326,7 @@ describe('CategoricalColorScale', () => {
});
describe('.getNextAvailableColor(currentLabel, currentColor)', () => {
- it('returns the current color if it is the least used or equally used among colors', () => {
+ test('returns the current color if it is the least used or equally used among colors', () => {
const scale = new CategoricalColorScale(['blue', 'red', 'green']);
scale.getColor('cat');
scale.getColor('dog');
@@ -335,7 +335,7 @@ describe('CategoricalColorScale', () => {
expect(scale.getNextAvailableColor('fish', 'blue')).toBe('green');
});
- it('returns the least used color among all', () => {
+ test('returns the least used color among all', () => {
const scale = new CategoricalColorScale(['blue', 'red', 'green']);
scale.getColor('cat'); // blue
scale.getColor('dog'); // red
@@ -346,7 +346,7 @@ describe('CategoricalColorScale', () => {
expect(scale.getNextAvailableColor('darling', 'red')).toBe('green');
});
- it('returns the least used color accurately even when some colors are used more frequently', () => {
+ test('returns the least used color accurately even when some colors are used more frequently', () => {
const scale = new CategoricalColorScale([
'blue',
'red',
@@ -364,7 +364,7 @@ describe('CategoricalColorScale', () => {
// Yellow is the least used color, so it should be returned.
expect(scale.getNextAvailableColor('pony', 'blue')).toBe('yellow');
});
- it('does not return adjacent colors if a non-adjacent color is equally used', () => {
+ test('does not return adjacent colors if a non-adjacent color is equally used', () => {
const scale = new CategoricalColorScale(['blue', 'red', 'green']);
scale.chartLabelsColorMap.set('label1', 'red'); // Adjacent
scale.chartLabelsColorMap.set('label2', 'blue'); // currentLabel
@@ -373,7 +373,7 @@ describe('CategoricalColorScale', () => {
// Green and blue are equally used, but green is adjacent and penalized.
expect(scale.getNextAvailableColor('label2', 'blue')).toBe('blue');
});
- it('prioritizes a color that has never been used, even if there are adjacent colors', () => {
+ test('prioritizes a color that has never been used, even if there are adjacent colors', () => {
const scale = new CategoricalColorScale(['blue', 'red', 'green']);
scale.getColor('cat'); // blue
scale.getColor('dog'); // red
@@ -384,7 +384,7 @@ describe('CategoricalColorScale', () => {
// Green has never been used, so it is prioritized.
expect(scale.getNextAvailableColor('label2', 'blue')).toBe('green');
});
- it('returns the least used or unused color when there are no adjacent labels', () => {
+ test('returns the least used or unused color when there are no adjacent labels', () => {
const scale = new CategoricalColorScale(['blue', 'red', 'green']);
scale.getColor('cat'); // blue
scale.getColor('dog'); // red
@@ -392,7 +392,7 @@ describe('CategoricalColorScale', () => {
// No adjacent labels are defined in chartLabelsColorMap.
expect(scale.getNextAvailableColor('label2', 'green')).toBe('green');
});
- it('handles colors that have never been used (fallback to usage count 0)', () => {
+ test('handles colors that have never been used (fallback to usage count 0)', () => {
const scale = new CategoricalColorScale(['blue', 'red', 'green']);
// Do not use "green" at all
@@ -402,7 +402,7 @@ describe('CategoricalColorScale', () => {
// "green" has never been used, so usageCount for "green" should fallback to 0
expect(scale.getNextAvailableColor('label2', 'red')).toBe('green');
});
- it('handles a color with an explicit usage count of 0', () => {
+ test('handles a color with an explicit usage count of 0', () => {
const scale = new CategoricalColorScale(['blue', 'red', 'green']);
// Mock or override getColorUsageCount to return 0 for "blue"
@@ -417,7 +417,7 @@ describe('CategoricalColorScale', () => {
});
describe('.isColorUsed(color)', () => {
- it('returns true if the color is already used, false otherwise', () => {
+ test('returns true if the color is already used, false otherwise', () => {
const scale = new CategoricalColorScale(['blue', 'red', 'green']);
// Initially, no color is used
expect(scale.isColorUsed('blue')).toBe(false);
@@ -442,7 +442,7 @@ describe('CategoricalColorScale', () => {
});
describe('.getColorUsageCount(color)', () => {
- it('accurately counts the occurrences of a specific color', () => {
+ test('accurately counts the occurrences of a specific color', () => {
const scale = new CategoricalColorScale([
'blue',
'red',
@@ -480,7 +480,7 @@ describe('CategoricalColorScale', () => {
});
describe("is compatible with D3's ScaleOrdinal", () => {
- it('passes type check', () => {
+ test('passes type check', () => {
const scale: ScaleOrdinal<{ toString(): string }, string> =
new CategoricalColorScale(['blue', 'red', 'green']);
expect(scale('pig')).toBe('blue');
diff --git a/superset-frontend/packages/superset-ui-core/test/color/CategoricalSchemeRegistrySingleton.test.ts b/superset-frontend/packages/superset-ui-core/test/color/CategoricalSchemeRegistrySingleton.test.ts
index dcbf8126f43..7db86cf280c 100644
--- a/superset-frontend/packages/superset-ui-core/test/color/CategoricalSchemeRegistrySingleton.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/color/CategoricalSchemeRegistrySingleton.test.ts
@@ -23,7 +23,7 @@ import {
} from '@superset-ui/core';
describe('CategoricalSchemeRegistry', () => {
- it('has default value out-of-the-box', () => {
+ test('has default value out-of-the-box', () => {
expect(getCategoricalSchemeRegistry().get()).toBeInstanceOf(
CategoricalScheme,
);
diff --git a/superset-frontend/packages/superset-ui-core/test/color/ColorScheme.test.ts b/superset-frontend/packages/superset-ui-core/test/color/ColorScheme.test.ts
index 90bbfaa558c..37ec9a5c700 100644
--- a/superset-frontend/packages/superset-ui-core/test/color/ColorScheme.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/color/ColorScheme.test.ts
@@ -21,7 +21,7 @@ import ColorScheme from '../../src/color/ColorScheme';
describe('ColorScheme', () => {
describe('new ColorScheme()', () => {
- it('returns an instance of ColorScheme', () => {
+ test('returns an instance of ColorScheme', () => {
const scheme = new ColorScheme({ id: 'test', colors: ['red', 'blue'] });
expect(scheme).toBeInstanceOf(ColorScheme);
});
diff --git a/superset-frontend/packages/superset-ui-core/test/color/ColorSchemeRegistry.test.ts b/superset-frontend/packages/superset-ui-core/test/color/ColorSchemeRegistry.test.ts
index 13aa49922f4..4360a5844de 100644
--- a/superset-frontend/packages/superset-ui-core/test/color/ColorSchemeRegistry.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/color/ColorSchemeRegistry.test.ts
@@ -22,20 +22,20 @@ import schemes from '../../src/color/colorSchemes/categorical/d3';
import CategoricalScheme from '../../src/color/CategoricalScheme';
describe('ColorSchemeRegistry', () => {
- it('exists', () => {
+ test('exists', () => {
expect(ColorSchemeRegistry).toBeDefined();
expect(ColorSchemeRegistry).toBeInstanceOf(Function);
});
- it('returns undefined', () => {
+ test('returns undefined', () => {
const registry = new ColorSchemeRegistry();
expect(registry.get('something')).toBeUndefined();
});
- it('returns default', () => {
+ test('returns default', () => {
const registry = new ColorSchemeRegistry();
registry.registerValue('SUPERSET_DEFAULT', schemes[0]);
expect(registry.get('something')).toBeInstanceOf(CategoricalScheme);
});
- it('returns undefined in strict mode', () => {
+ test('returns undefined in strict mode', () => {
const registry = new ColorSchemeRegistry();
registry.registerValue('SUPERSET_DEFAULT', schemes[0]);
expect(registry.get('something', true)).toBeUndefined();
diff --git a/superset-frontend/packages/superset-ui-core/test/color/LabelsColorMapSingleton.test.ts b/superset-frontend/packages/superset-ui-core/test/color/LabelsColorMapSingleton.test.ts
index c4ac0e4ff31..53ecc6ffadb 100644
--- a/superset-frontend/packages/superset-ui-core/test/color/LabelsColorMapSingleton.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/color/LabelsColorMapSingleton.test.ts
@@ -56,12 +56,12 @@ describe('LabelsColorMap', () => {
getLabelsColorMap().reset();
});
- it('has default value out-of-the-box', () => {
+ test('has default value out-of-the-box', () => {
expect(getLabelsColorMap()).toBeInstanceOf(LabelsColorMap);
});
describe('.addSlice(value, color, sliceId)', () => {
- it('should add to sliceLabelColorMap when first adding label', () => {
+ test('should add to sliceLabelColorMap when first adding label', () => {
const labelsColorMap = getLabelsColorMap();
labelsColorMap.addSlice('a', 'red', 1, 'preset');
expect(labelsColorMap.chartsLabelsMap.has(1)).toEqual(true);
@@ -71,7 +71,7 @@ describe('LabelsColorMap', () => {
expect(Object.fromEntries(colorMap)).toEqual({ a: 'red' });
});
- it('should add to sliceLabelColorMap when slice exist', () => {
+ test('should add to sliceLabelColorMap when slice exist', () => {
const labelsColorMap = getLabelsColorMap();
labelsColorMap.addSlice('a', 'red', 1);
labelsColorMap.addSlice('b', 'blue', 1);
@@ -81,7 +81,7 @@ describe('LabelsColorMap', () => {
expect(Object.fromEntries(colorMap)).toEqual({ a: 'red', b: 'blue' });
});
- it('should use last color if adding label repeatedly', () => {
+ test('should use last color if adding label repeatedly', () => {
const labelsColorMap = getLabelsColorMap();
labelsColorMap.addSlice('b', 'blue', 1);
labelsColorMap.addSlice('b', 'green', 1);
@@ -92,7 +92,7 @@ describe('LabelsColorMap', () => {
expect(Object.fromEntries(colorMap)).toEqual({ b: 'green' });
});
- it('should set a new color only when source is dashboard', () => {
+ test('should set a new color only when source is dashboard', () => {
const labelsColorMap = getLabelsColorMap();
labelsColorMap.source = LabelsColorMapSource.Explore;
labelsColorMap.addSlice('a', 'red', 1);
@@ -107,14 +107,14 @@ describe('LabelsColorMap', () => {
});
describe('.remove(sliceId)', () => {
- it('should remove sliceId', () => {
+ test('should remove sliceId', () => {
const labelsColorMap = getLabelsColorMap();
labelsColorMap.addSlice('a', 'red', 1);
labelsColorMap.removeSlice(1);
expect(labelsColorMap.chartsLabelsMap.has(1)).toEqual(false);
});
- it('should update colorMap', () => {
+ test('should update colorMap', () => {
const labelsColorMap = getLabelsColorMap();
labelsColorMap.addSlice('a', 'red', 1);
labelsColorMap.addSlice('b', 'blue', 2);
@@ -123,7 +123,7 @@ describe('LabelsColorMap', () => {
expect(Object.fromEntries(colorMap)).toEqual({ b: 'blue' });
});
- it('should do nothing when source is not dashboard', () => {
+ test('should do nothing when source is not dashboard', () => {
const labelsColorMap = getLabelsColorMap();
labelsColorMap.addSlice('a', 'red', 1);
labelsColorMap.source = LabelsColorMapSource.Explore;
@@ -147,32 +147,32 @@ describe('LabelsColorMap', () => {
};
});
- it('should clear color map when not merge', () => {
+ test('should clear color map when not merge', () => {
labelsColorMap.addSlice('a', 'red', 1);
labelsColorMap.updateColorMap(mockedNamespace, 'testColors2', false);
expect(labelsColorMap.colorMap).toEqual(new Map([['a', 'mockColor']]));
});
- it('should not clear color map when merge', () => {
+ test('should not clear color map when merge', () => {
labelsColorMap.addSlice('a', 'red', 1);
labelsColorMap.updateColorMap(mockedNamespace, 'testColors2', true);
expect(labelsColorMap.colorMap).not.toEqual(new Map());
});
- it('should use provided color scheme', () => {
+ test('should use provided color scheme', () => {
labelsColorMap.addSlice('a', 'red', 1);
labelsColorMap.updateColorMap(mockedNamespace, 'testColors2');
expect(mockedNamespace.getScale).toHaveBeenCalledWith('testColors2');
});
- it('should fallback to undefined if no color scheme is provided', () => {
+ test('should fallback to undefined if no color scheme is provided', () => {
labelsColorMap.addSlice('a', 'red', 1);
labelsColorMap.addSlice('b', 'blue', 2);
labelsColorMap.updateColorMap(mockedNamespace);
expect(mockedNamespace.getScale).toHaveBeenCalledWith(undefined);
});
- it('should update color map', () => {
+ test('should update color map', () => {
// override color with forcedItems
categoricalNamespace.setColor('b', 'green');
// testColors2: 'yellow', 'green', 'blue'
@@ -193,7 +193,7 @@ describe('LabelsColorMap', () => {
});
});
- it('should update only new labels in the color map when merge', () => {
+ test('should update only new labels in the color map when merge', () => {
labelsColorMap.colorMap = new Map();
labelsColorMap.addSlice('a', 'yellow', 1);
@@ -210,7 +210,7 @@ describe('LabelsColorMap', () => {
});
});
- it('should use recycle colors', () => {
+ test('should use recycle colors', () => {
window.featureFlags = {
[FeatureFlag.UseAnalogousColors]: false,
};
@@ -224,7 +224,7 @@ describe('LabelsColorMap', () => {
expect(getAnalogousColorsSpy).not.toHaveBeenCalled();
});
- it('should use analogous colors', () => {
+ test('should use analogous colors', () => {
window.featureFlags = {
[FeatureFlag.UseAnalogousColors]: true,
};
@@ -241,7 +241,7 @@ describe('LabelsColorMap', () => {
});
describe('.getColorMap()', () => {
- it('should get color map', () => {
+ test('should get color map', () => {
const labelsColorMap = getLabelsColorMap();
labelsColorMap.addSlice('a', 'red', 1);
labelsColorMap.addSlice('b', 'blue', 2);
@@ -251,7 +251,7 @@ describe('LabelsColorMap', () => {
});
describe('.reset()', () => {
- it('should reset color map', () => {
+ test('should reset color map', () => {
const labelsColorMap = getLabelsColorMap();
labelsColorMap.addSlice('a', 'red', 1);
labelsColorMap.addSlice('b', 'blue', 2);
@@ -262,7 +262,7 @@ describe('LabelsColorMap', () => {
});
describe('setOwnColorScheme(sliceId, ownScheme)', () => {
- it('should update the scheme in the config', () => {
+ test('should update the scheme in the config', () => {
const labelsColorMap = getLabelsColorMap();
labelsColorMap.source = LabelsColorMapSource.Explore;
const sliceId = 1;
@@ -278,7 +278,7 @@ describe('LabelsColorMap', () => {
ownScheme: 'newScheme',
});
});
- it('should update ownScheme when source is not Explore', () => {
+ test('should update ownScheme when source is not Explore', () => {
const labelsColorMap = getLabelsColorMap();
labelsColorMap.source = LabelsColorMapSource.Dashboard;
const sliceId = 1;
@@ -294,7 +294,7 @@ describe('LabelsColorMap', () => {
ownScheme: 'newScheme',
});
});
- it('should do nothing when chart config does not exist', () => {
+ test('should do nothing when chart config does not exist', () => {
const labelsColorMap = getLabelsColorMap();
labelsColorMap.source = LabelsColorMapSource.Explore;
const sliceId = 1;
diff --git a/superset-frontend/packages/superset-ui-core/test/color/SequentialScheme.test.ts b/superset-frontend/packages/superset-ui-core/test/color/SequentialScheme.test.ts
index c4056f4369d..f94b8a8509c 100644
--- a/superset-frontend/packages/superset-ui-core/test/color/SequentialScheme.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/color/SequentialScheme.test.ts
@@ -24,11 +24,11 @@ describe('SequentialScheme', () => {
id: 'white to black',
colors: ['#fff', '#000'],
});
- it('exists', () => {
+ test('exists', () => {
expect(SequentialScheme).toBeDefined();
});
describe('new SequentialScheme()', () => {
- it('creates new instance', () => {
+ test('creates new instance', () => {
const scheme2 = new SequentialScheme({
id: 'white to black',
colors: ['#fff', '#000'],
@@ -37,14 +37,14 @@ describe('SequentialScheme', () => {
});
});
describe('.createLinearScale(domain, modifyRange)', () => {
- it('returns a piecewise scale', () => {
+ test('returns a piecewise scale', () => {
const scale = scheme.createLinearScale([10, 100]);
expect(scale.domain()).toHaveLength(scale.range().length);
const scale2 = scheme.createLinearScale([0, 10, 100]);
expect(scale2.domain()).toHaveLength(scale2.range().length);
});
describe('domain', () => {
- it('returns a linear scale for the given domain', () => {
+ test('returns a linear scale for the given domain', () => {
const scale = scheme.createLinearScale([10, 100]);
expect(scale(1)).toEqual('rgb(255, 255, 255)');
expect(scale(10)).toEqual('rgb(255, 255, 255)');
@@ -52,7 +52,7 @@ describe('SequentialScheme', () => {
expect(scale(100)).toEqual('rgb(0, 0, 0)');
expect(scale(1000)).toEqual('rgb(0, 0, 0)');
});
- it('uses [0, 1] as domain if not specified', () => {
+ test('uses [0, 1] as domain if not specified', () => {
const scale = scheme.createLinearScale();
expect(scale(-1)).toEqual('rgb(255, 255, 255)');
expect(scale(0)).toEqual('rgb(255, 255, 255)');
@@ -66,12 +66,12 @@ describe('SequentialScheme', () => {
id: 'test-scheme3',
colors: ['#fee087', '#fa5c2e', '#800026'],
});
- it('modifies domain by default', () => {
+ test('modifies domain by default', () => {
const scale = scheme3.createLinearScale([0, 100]);
expect(scale.domain()).toEqual([0, 50, 100]);
expect(scale.range()).toEqual(['#fee087', '#fa5c2e', '#800026']);
});
- it('modifies range instead of domain if set to true', () => {
+ test('modifies range instead of domain if set to true', () => {
const scale = scheme3.createLinearScale([0, 100], true);
expect(scale.domain()).toEqual([0, 100]);
expect(scale.range()).toEqual([
@@ -83,10 +83,10 @@ describe('SequentialScheme', () => {
});
describe('.getColors(numColors, extent)', () => {
describe('numColors', () => {
- it('returns the original colors if numColors is not specified', () => {
+ test('returns the original colors if numColors is not specified', () => {
expect(scheme.getColors()).toEqual(['#fff', '#000']);
});
- it('returns the exact number of colors if numColors is specified', () => {
+ test('returns the exact number of colors if numColors is specified', () => {
expect(scheme.getColors(2)).toEqual(['#fff', '#000']);
expect(scheme.getColors(3)).toEqual([
'rgb(255, 255, 255)',
@@ -102,7 +102,7 @@ describe('SequentialScheme', () => {
});
});
describe('extent', () => {
- it('adjust the range if extent is specified', () => {
+ test('adjust the range if extent is specified', () => {
expect(scheme.getColors(2, [0, 0.5])).toEqual([
'rgb(255, 255, 255)',
'rgb(119, 119, 119)',
diff --git a/superset-frontend/packages/superset-ui-core/test/color/SequentialSchemeRegistrySingleton.test.ts b/superset-frontend/packages/superset-ui-core/test/color/SequentialSchemeRegistrySingleton.test.ts
index 8a62fc24911..32c502e378f 100644
--- a/superset-frontend/packages/superset-ui-core/test/color/SequentialSchemeRegistrySingleton.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/color/SequentialSchemeRegistrySingleton.test.ts
@@ -23,7 +23,7 @@ import {
} from '@superset-ui/core';
describe('SequentialSchemeRegistry', () => {
- it('has default value out-of-the-box', () => {
+ test('has default value out-of-the-box', () => {
expect(getSequentialSchemeRegistry().get()).toBeInstanceOf(
SequentialScheme,
);
diff --git a/superset-frontend/packages/superset-ui-core/test/color/colorSchemes.test.ts b/superset-frontend/packages/superset-ui-core/test/color/colorSchemes.test.ts
index f241cee6e6a..608fccc5113 100644
--- a/superset-frontend/packages/superset-ui-core/test/color/colorSchemes.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/color/colorSchemes.test.ts
@@ -32,7 +32,7 @@ import {
describe('Color Schemes', () => {
describe('categorical', () => {
- it('returns an array of CategoricalScheme', () => {
+ test('returns an array of CategoricalScheme', () => {
[
CategoricalAirbnb,
CategoricalEcharts,
@@ -50,7 +50,7 @@ describe('Color Schemes', () => {
});
});
describe('sequential', () => {
- it('returns an array of SequentialScheme', () => {
+ test('returns an array of SequentialScheme', () => {
[SequentialCommon, SequentialD3].forEach(group => {
expect(group).toBeInstanceOf(Array);
group.forEach(scheme =>
diff --git a/superset-frontend/packages/superset-ui-core/test/color/index.test.ts b/superset-frontend/packages/superset-ui-core/test/color/index.test.ts
index 42891808d2f..6018fb4c442 100644
--- a/superset-frontend/packages/superset-ui-core/test/color/index.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/color/index.test.ts
@@ -28,7 +28,7 @@ import {
} from '@superset-ui/core';
describe('index', () => {
- it('exports modules', () => {
+ test('exports modules', () => {
[
BRAND_COLOR,
CategoricalColorNamespace,
diff --git a/superset-frontend/packages/superset-ui-core/test/color/utils.test.ts b/superset-frontend/packages/superset-ui-core/test/color/utils.test.ts
index 131ea04a782..e481a1d7e80 100644
--- a/superset-frontend/packages/superset-ui-core/test/color/utils.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/color/utils.test.ts
@@ -26,59 +26,59 @@ import {
describe('color utils', () => {
describe('getContrastingColor', () => {
- it('when called with 3-digit hex color', () => {
+ test('when called with 3-digit hex color', () => {
const color = getContrastingColor('#000');
expect(color).toBe('#FFF');
});
- it('when called with 6-digit hex color', () => {
+ test('when called with 6-digit hex color', () => {
const color = getContrastingColor('#000000');
expect(color).toBe('#FFF');
});
- it('when called with no # prefix hex color', () => {
+ test('when called with no # prefix hex color', () => {
const color = getContrastingColor('000000');
expect(color).toBe('#FFF');
});
- it('when called with rgb color', () => {
+ test('when called with rgb color', () => {
const color = getContrastingColor('rgb(0, 0, 0)');
expect(color).toBe('#FFF');
});
- it('when called with thresholds', () => {
+ test('when called with thresholds', () => {
const color1 = getContrastingColor('rgb(255, 255, 255)');
const color2 = getContrastingColor('rgb(255, 255, 255)', 255);
expect(color1).toBe('#000');
expect(color2).toBe('#FFF');
});
- it('when called with rgba color, throw error', () => {
+ test('when called with rgba color, throw error', () => {
expect(() => {
getContrastingColor('rgba(0, 0, 0, 0.1)');
}).toThrow();
});
- it('when called with invalid color, throw error', () => {
+ test('when called with invalid color, throw error', () => {
expect(() => {
getContrastingColor('#0000');
}).toThrow();
});
});
describe('addAlpha', () => {
- it('adds 20% opacity to black', () => {
+ test('adds 20% opacity to black', () => {
expect(addAlpha('#000000', 0.2)).toBe('#00000033');
});
- it('adds 50% opacity to white', () => {
+ test('adds 50% opacity to white', () => {
expect(addAlpha('#FFFFFF', 0.5)).toBe('#FFFFFF80');
});
- it('should apply transparent alpha', () => {
+ test('should apply transparent alpha', () => {
expect(addAlpha('#000000', 0)).toBe('#00000000');
});
- it('should apply fully opaque', () => {
+ test('should apply fully opaque', () => {
expect(addAlpha('#000000', 1)).toBe('#000000FF');
});
- it('opacity should be between 0 and 1', () => {
+ test('opacity should be between 0 and 1', () => {
expect(() => {
addAlpha('#000000', 2);
}).toThrow();
@@ -88,21 +88,21 @@ describe('color utils', () => {
});
});
describe('hexToRgb', () => {
- it('convert 3 digits hex', () => {
+ test('convert 3 digits hex', () => {
expect(hexToRgb('#fff')).toBe('rgb(255, 255, 255)');
});
- it('convert 6 digits hex', () => {
+ test('convert 6 digits hex', () => {
expect(hexToRgb('#ffffff')).toBe('rgb(255, 255, 255)');
});
- it('convert invalid hex', () => {
+ test('convert invalid hex', () => {
expect(hexToRgb('#ffffffffffffff')).toBe('rgb(0, 0, 0)');
});
});
describe('rgbToHex', () => {
- it('convert rgb to hex - white', () => {
+ test('convert rgb to hex - white', () => {
expect(rgbToHex(255, 255, 255)).toBe('#ffffff');
});
- it('convert rgb to hex - black', () => {
+ test('convert rgb to hex - black', () => {
expect(rgbToHex(0, 0, 0)).toBe('#000000');
});
});
diff --git a/superset-frontend/packages/superset-ui-core/test/components/Icons/AsyncIcon.integration.test.tsx b/superset-frontend/packages/superset-ui-core/test/components/Icons/AsyncIcon.integration.test.tsx
index 2651f730b54..7e36a460bf6 100644
--- a/superset-frontend/packages/superset-ui-core/test/components/Icons/AsyncIcon.integration.test.tsx
+++ b/superset-frontend/packages/superset-ui-core/test/components/Icons/AsyncIcon.integration.test.tsx
@@ -45,7 +45,7 @@ const mockTheme: SupersetTheme = {
} as SupersetTheme;
describe('AsyncIcon Integration Tests (Real Component)', () => {
- it('should have data-test and aria-label attributes with real component', () => {
+ test('should have data-test and aria-label attributes with real component', () => {
const { container } = render(
@@ -61,7 +61,7 @@ describe('AsyncIcon Integration Tests (Real Component)', () => {
expect(spanElement).toHaveAttribute('data-test', 'slack');
});
- it('should always have aria-label and data-test for testing', () => {
+ test('should always have aria-label and data-test for testing', () => {
const { container } = render(
@@ -81,7 +81,7 @@ describe('AsyncIcon Integration Tests (Real Component)', () => {
expect(dataTest).toBe('slack');
});
- it('should set role to button when onClick is provided in real component', () => {
+ test('should set role to button when onClick is provided in real component', () => {
const onClick = jest.fn();
const { container } = render(
@@ -105,7 +105,7 @@ describe('AsyncIcon Integration Tests (Real Component)', () => {
expect(onClick).toHaveBeenCalledTimes(1);
});
- it('should handle complex fileName patterns like BaseIcon', () => {
+ test('should handle complex fileName patterns like BaseIcon', () => {
const { container } = render(
diff --git a/superset-frontend/packages/superset-ui-core/test/components/SafeMarkdown.test.tsx b/superset-frontend/packages/superset-ui-core/test/components/SafeMarkdown.test.tsx
index fec145ef125..2b499c19851 100644
--- a/superset-frontend/packages/superset-ui-core/test/components/SafeMarkdown.test.tsx
+++ b/superset-frontend/packages/superset-ui-core/test/components/SafeMarkdown.test.tsx
@@ -33,7 +33,7 @@ import {
*/
describe('getOverrideHtmlSchema', () => {
- it('should append the override items', () => {
+ test('should append the override items', () => {
const original = {
attributes: {
'*': ['size'],
@@ -71,7 +71,7 @@ describe('SafeMarkdown', () => {
* This test will FAIL if remark-gfm is upgraded to v4+ without upgrading
* react-markdown to v9+ (which requires React 18).
*/
- it('should render GitHub Flavored Markdown tables without errors', () => {
+ test('should render GitHub Flavored Markdown tables without errors', () => {
const markdownWithTable = `
| Header 1 | Header 2 | Header 3 |
|----------|----------|----------|
@@ -92,7 +92,7 @@ describe('SafeMarkdown', () => {
* Tests that inline code blocks with backticks work correctly.
* This was the original issue that led to pinning remark-gfm to v3.
*/
- it('should render inline code blocks with backticks', () => {
+ test('should render inline code blocks with backticks', () => {
const markdownWithCode = 'Use `console.log()` for debugging';
expect(() => {
@@ -105,7 +105,7 @@ describe('SafeMarkdown', () => {
*
* Ensures other remark-gfm features work correctly with v3.
*/
- it('should render strikethrough text', () => {
+ test('should render strikethrough text', () => {
const markdownWithStrikethrough = '~~This is strikethrough text~~';
expect(() => {
@@ -118,7 +118,7 @@ describe('SafeMarkdown', () => {
*
* Ensures task lists render correctly with v3.
*/
- it('should render task lists', () => {
+ test('should render task lists', () => {
const markdownWithTaskList = `
- [x] Completed task
- [ ] Incomplete task
@@ -134,7 +134,7 @@ describe('SafeMarkdown', () => {
*
* Tests that all GFM features work together without conflicts.
*/
- it('should render complex markdown with multiple GFM features', () => {
+ test('should render complex markdown with multiple GFM features', () => {
const complexMarkdown = `
# Dashboard Overview
diff --git a/superset-frontend/packages/superset-ui-core/test/connection/SupersetClient.test.ts b/superset-frontend/packages/superset-ui-core/test/connection/SupersetClient.test.ts
index 8174fb8ad43..92efac60892 100644
--- a/superset-frontend/packages/superset-ui-core/test/connection/SupersetClient.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/connection/SupersetClient.test.ts
@@ -31,7 +31,7 @@ describe('SupersetClient', () => {
afterEach(() => SupersetClient.reset());
- it('exposes reset, configure, init, get, post, postForm, isAuthenticated, and reAuthenticate methods', () => {
+ test('exposes reset, configure, init, get, post, postForm, isAuthenticated, and reAuthenticate methods', () => {
expect(typeof SupersetClient.configure).toBe('function');
expect(typeof SupersetClient.init).toBe('function');
expect(typeof SupersetClient.get).toBe('function');
@@ -44,7 +44,7 @@ describe('SupersetClient', () => {
expect(typeof SupersetClient.reset).toBe('function');
});
- it('throws if you call init, get, post, postForm, isAuthenticated, or reAuthenticate before configure', () => {
+ test('throws if you call init, get, post, postForm, isAuthenticated, or reAuthenticate before configure', () => {
expect(SupersetClient.init).toThrow();
expect(SupersetClient.get).toThrow();
expect(SupersetClient.post).toThrow();
@@ -56,7 +56,7 @@ describe('SupersetClient', () => {
});
// this also tests that the ^above doesn't throw if configure is called appropriately
- it('calls appropriate SupersetClient methods when configured', async () => {
+ test('calls appropriate SupersetClient methods when configured', async () => {
expect.assertions(16);
const mockGetUrl = '/mock/get/url';
const mockPostUrl = '/mock/post/url';
diff --git a/superset-frontend/packages/superset-ui-core/test/connection/SupersetClientClass.test.ts b/superset-frontend/packages/superset-ui-core/test/connection/SupersetClientClass.test.ts
index b26ab3170c7..e5020b20812 100644
--- a/superset-frontend/packages/superset-ui-core/test/connection/SupersetClientClass.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/connection/SupersetClientClass.test.ts
@@ -30,7 +30,7 @@ describe('SupersetClientClass', () => {
});
describe('new SupersetClientClass()', () => {
- it('fallback protocol to https when setting only host', () => {
+ test('fallback protocol to https when setting only host', () => {
const client = new SupersetClientClass({ host: 'TEST-HOST' });
expect(client.protocol).toEqual('https:');
expect(client.host).toEqual('test-host');
@@ -47,13 +47,13 @@ describe('SupersetClientClass', () => {
});
});
- it('uses url if passed', () => {
+ test('uses url if passed', () => {
expect(
client.getUrl({ url: 'myUrl', endpoint: 'blah', host: 'blah' }),
).toBe('myUrl');
});
- it('constructs a valid url from config.protocol + host + endpoint if passed', () => {
+ test('constructs a valid url from config.protocol + host + endpoint if passed', () => {
expect(client.getUrl({ endpoint: '/test', host: 'myhost' })).toBe(
'https://myhost/test',
);
@@ -68,13 +68,13 @@ describe('SupersetClientClass', () => {
);
});
- it('constructs a valid url from config.host + endpoint if host is omitted', () => {
+ test('constructs a valid url from config.host + endpoint if host is omitted', () => {
expect(client.getUrl({ endpoint: '/test' })).toBe(
'https://config_host/test',
);
});
- it('constructs a valid url if url, endpoint, and host are all empty and appRoot is defined', () => {
+ test('constructs a valid url if url, endpoint, and host are all empty and appRoot is defined', () => {
client = new SupersetClientClass({
protocol: 'https:',
host: 'config_host',
@@ -83,7 +83,7 @@ describe('SupersetClientClass', () => {
expect(client.getUrl()).toBe('https://config_host/prefix/');
});
- it('does not throw if url, endpoint, and host are all empty', () => {
+ test('does not throw if url, endpoint, and host are all empty', () => {
client = new SupersetClientClass({ protocol: 'https:', host: '' });
expect(client.getUrl()).toBe('https://localhost/');
});
@@ -96,19 +96,19 @@ describe('SupersetClientClass', () => {
});
afterEach(() => fetchMock.clearHistory().removeRoutes());
- it('calls api/v1/security/csrf_token/ when init() is called if no CSRF token is passed', async () => {
+ test('calls api/v1/security/csrf_token/ when init() is called if no CSRF token is passed', async () => {
// expect.assertions(1);
await new SupersetClientClass().init();
expect(fetchMock.callHistory.calls(LOGIN_GLOB)).toHaveLength(1);
});
- it('does NOT call api/v1/security/csrf_token/ when init() is called if a CSRF token is passed', async () => {
+ test('does NOT call api/v1/security/csrf_token/ when init() is called if a CSRF token is passed', async () => {
expect.assertions(1);
await new SupersetClientClass({ csrfToken: 'abc' }).init();
expect(fetchMock.callHistory.calls(LOGIN_GLOB)).toHaveLength(0);
});
- it('calls api/v1/security/csrf_token/ when init(force=true) is called even if a CSRF token is passed', async () => {
+ test('calls api/v1/security/csrf_token/ when init(force=true) is called even if a CSRF token is passed', async () => {
expect.assertions(4);
const initialToken = 'initial_token';
const client = new SupersetClientClass({ csrfToken: initialToken });
@@ -122,7 +122,7 @@ describe('SupersetClientClass', () => {
expect(client.csrfToken).not.toBe(initialToken);
});
- it('throws if api/v1/security/csrf_token/ returns an error', async () => {
+ test('throws if api/v1/security/csrf_token/ returns an error', async () => {
expect.assertions(1);
const rejectError = { status: 403 };
fetchMock.removeRoute(LOGIN_GLOB);
@@ -140,7 +140,7 @@ describe('SupersetClientClass', () => {
const invalidCsrfTokenError = { error: 'Failed to fetch CSRF token' };
- it('throws if api/v1/security/csrf_token/ does not return a token', async () => {
+ test('throws if api/v1/security/csrf_token/ does not return a token', async () => {
expect.assertions(1);
fetchMock.modifyRoute(LOGIN_GLOB, { response: {} });
@@ -156,7 +156,7 @@ describe('SupersetClientClass', () => {
}
});
- it('does not set csrfToken if response is not json', async () => {
+ test('does not set csrfToken if response is not json', async () => {
expect.assertions(1);
fetchMock.removeRoute(LOGIN_GLOB);
fetchMock.get(LOGIN_GLOB, { response: '123' }, { name: LOGIN_GLOB });
@@ -177,7 +177,7 @@ describe('SupersetClientClass', () => {
describe('.isAuthenticated()', () => {
afterEach(() => fetchMock.clearHistory().removeRoutes());
- it('returns true if there is a token and false if not', async () => {
+ test('returns true if there is a token and false if not', async () => {
expect.assertions(2);
const client = new SupersetClientClass({});
expect(client.isAuthenticated()).toBe(false);
@@ -185,7 +185,7 @@ describe('SupersetClientClass', () => {
expect(client.isAuthenticated()).toBe(true);
});
- it('returns true if a token is passed at configuration', () => {
+ test('returns true if a token is passed at configuration', () => {
expect.assertions(2);
const clientWithoutToken = new SupersetClientClass({
csrfToken: undefined,
@@ -197,7 +197,7 @@ describe('SupersetClientClass', () => {
});
describe('.ensureAuth()', () => {
- it(`returns a promise that rejects if .init() has not been called`, async () => {
+ test(`returns a promise that rejects if .init() has not been called`, async () => {
expect.assertions(2);
const client = new SupersetClientClass({});
@@ -213,7 +213,7 @@ describe('SupersetClientClass', () => {
expect(client.isAuthenticated()).toBe(false);
});
- it('returns a promise that resolves if .init() resolves successfully', async () => {
+ test('returns a promise that resolves if .init() resolves successfully', async () => {
expect.assertions(1);
const client = new SupersetClientClass({});
@@ -223,7 +223,7 @@ describe('SupersetClientClass', () => {
expect(client.isAuthenticated()).toBe(true);
});
- it(`returns a promise that rejects if .init() is unsuccessful`, async () => {
+ test(`returns a promise that rejects if .init() is unsuccessful`, async () => {
expect.assertions(4);
const rejectValue = { status: 403 };
@@ -293,7 +293,7 @@ describe('SupersetClientClass', () => {
fetchMock.post(mockTextUrl, mockTextJsonResponse);
});
- it('checks for authentication before every get and post request', async () => {
+ test('checks for authentication before every get and post request', async () => {
expect.assertions(6);
const authSpy = jest.spyOn(SupersetClientClass.prototype, 'ensureAuth');
@@ -316,7 +316,7 @@ describe('SupersetClientClass', () => {
authSpy.mockRestore();
});
- it('sets protocol, host, headers, mode, and credentials from config', async () => {
+ test('sets protocol, host, headers, mode, and credentials from config', async () => {
expect.assertions(3);
const clientConfig: ClientConfig = {
@@ -342,7 +342,7 @@ describe('SupersetClientClass', () => {
);
});
- it('uses a guest token when provided', async () => {
+ test('uses a guest token when provided', async () => {
expect.assertions(2);
const client = new SupersetClientClass({
@@ -365,7 +365,7 @@ describe('SupersetClientClass', () => {
});
describe('.get()', () => {
- it('makes a request using url or endpoint', async () => {
+ test('makes a request using url or endpoint', async () => {
expect.assertions(2);
const client = new SupersetClientClass({ protocol, host });
@@ -378,7 +378,7 @@ describe('SupersetClientClass', () => {
expect(fetchMock.callHistory.calls(mockGetUrl)).toHaveLength(2);
});
- it('supports parsing a response as text', async () => {
+ test('supports parsing a response as text', async () => {
expect.assertions(2);
const client = new SupersetClientClass({ protocol, host });
await client.init();
@@ -390,7 +390,7 @@ describe('SupersetClientClass', () => {
expect(text).toBe(mockTextJsonResponse);
});
- it('allows overriding host, headers, mode, and credentials per-request', async () => {
+ test('allows overriding host, headers, mode, and credentials per-request', async () => {
expect.assertions(3);
const clientConfig: ClientConfig = {
@@ -424,7 +424,7 @@ describe('SupersetClientClass', () => {
});
describe('.post()', () => {
- it('makes a request using url or endpoint', async () => {
+ test('makes a request using url or endpoint', async () => {
expect.assertions(2);
const client = new SupersetClientClass({ protocol, host });
@@ -437,7 +437,7 @@ describe('SupersetClientClass', () => {
expect(fetchMock.callHistory.calls(mockPostUrl)).toHaveLength(2);
});
- it('allows overriding host, headers, mode, and credentials per-request', async () => {
+ test('allows overriding host, headers, mode, and credentials per-request', async () => {
expect.assertions(3);
const clientConfig: ClientConfig = {
host,
@@ -469,7 +469,7 @@ describe('SupersetClientClass', () => {
);
});
- it('supports parsing a response as text', async () => {
+ test('supports parsing a response as text', async () => {
expect.assertions(2);
const client = new SupersetClientClass({ protocol, host });
await client.init();
@@ -481,7 +481,7 @@ describe('SupersetClientClass', () => {
expect(text).toBe(mockTextJsonResponse);
});
- it('passes postPayload key,values in the body', async () => {
+ test('passes postPayload key,values in the body', async () => {
expect.assertions(3);
const postPayload = { number: 123, array: [1, 2, 3] };
@@ -499,7 +499,7 @@ describe('SupersetClientClass', () => {
});
});
- it('respects the stringify parameter for postPayload key,values', async () => {
+ test('respects the stringify parameter for postPayload key,values', async () => {
expect.assertions(3);
const postPayload = { number: 123, array: [1, 2, 3] };
@@ -548,7 +548,7 @@ describe('SupersetClientClass', () => {
window.location = originalLocation;
});
- it('should redirect', async () => {
+ test('should redirect', async () => {
const client = new SupersetClientClass({});
let error;
@@ -563,7 +563,7 @@ describe('SupersetClientClass', () => {
}
});
- it('should not redirect again if already on login page', async () => {
+ test('should not redirect again if already on login page', async () => {
const client = new SupersetClientClass({});
window.location = {
@@ -582,7 +582,7 @@ describe('SupersetClientClass', () => {
expect(error.status).toBe(401);
}
});
- it('does nothing if instructed to ignoreUnauthorized', async () => {
+ test('does nothing if instructed to ignoreUnauthorized', async () => {
const client = new SupersetClientClass({});
let error;
@@ -601,7 +601,7 @@ describe('SupersetClientClass', () => {
}
});
- it('accepts an unauthorizedHandler to override redirect behavior', async () => {
+ test('accepts an unauthorizedHandler to override redirect behavior', async () => {
const unauthorizedHandler = jest.fn();
const client = new SupersetClientClass({ unauthorizedHandler });
@@ -661,7 +661,7 @@ describe('SupersetClientClass', () => {
jest.restoreAllMocks();
});
- it.each(['', '/prefix'])(
+ test.each(['', '/prefix'])(
"makes postForm request when appRoot is '%s'",
async appRoot => {
if (appRoot !== '') {
@@ -692,7 +692,7 @@ describe('SupersetClientClass', () => {
},
);
- it('makes postForm request with guest token', async () => {
+ test('makes postForm request with guest token', async () => {
client = new SupersetClientClass({ protocol, host, guestToken });
await client.init();
@@ -711,7 +711,7 @@ describe('SupersetClientClass', () => {
expect(authSpy).toHaveBeenCalledTimes(1);
});
- it('makes postForm request with payload', async () => {
+ test('makes postForm request with payload', async () => {
await client.postForm(mockPostFormUrl, { form_data: postFormPayload });
const postFormPayloadInput = createElement.mock.results[1].value;
@@ -728,7 +728,7 @@ describe('SupersetClientClass', () => {
expect(authSpy).toHaveBeenCalledTimes(1);
});
- it('should do nothing when url is empty string', async () => {
+ test('should do nothing when url is empty string', async () => {
const result = await client.postForm('', {});
expect(result).toBeUndefined();
expect(createElement.mock.calls).toHaveLength(0);
diff --git a/superset-frontend/packages/superset-ui-core/test/connection/callApi/callApi.test.ts b/superset-frontend/packages/superset-ui-core/test/connection/callApi/callApi.test.ts
index 35e8ea24fdb..ad64f7fca14 100644
--- a/superset-frontend/packages/superset-ui-core/test/connection/callApi/callApi.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/connection/callApi/callApi.test.ts
@@ -72,7 +72,7 @@ describe('callApi()', () => {
afterEach(() => fetchMock.clearHistory().removeRoutes());
describe('request config', () => {
- it('calls the right url with the specified method', async () => {
+ test('calls the right url with the specified method', async () => {
expect.assertions(4);
await Promise.all([
callApi({ url: mockGetUrl, method: 'GET' }),
@@ -86,7 +86,7 @@ describe('callApi()', () => {
expect(fetchMock.callHistory.calls(mockPatchUrl)).toHaveLength(1);
});
- it('passes along mode, cache, credentials, headers, body, signal, and redirect parameters in the request', async () => {
+ test('passes along mode, cache, credentials, headers, body, signal, and redirect parameters in the request', async () => {
expect.assertions(8);
const mockRequest: CallApi = {
url: mockGetUrl,
@@ -119,7 +119,7 @@ describe('callApi()', () => {
});
describe('POST requests', () => {
- it('encodes key,value pairs from postPayload', async () => {
+ test('encodes key,value pairs from postPayload', async () => {
expect.assertions(3);
const postPayload = { key: 'value', anotherKey: 1237 };
@@ -136,7 +136,7 @@ describe('callApi()', () => {
});
// the reason for this is to omit strings like 'undefined' from making their way to the backend
- it('omits key,value pairs from postPayload that have undefined values (POST)', async () => {
+ test('omits key,value pairs from postPayload that have undefined values (POST)', async () => {
expect.assertions(3);
const postPayload = { key: 'value', noValue: undefined };
@@ -150,7 +150,7 @@ describe('callApi()', () => {
expect(body.get('noValue')).toBeNull();
});
- it('respects the stringify flag in POST requests', async () => {
+ test('respects the stringify flag in POST requests', async () => {
const postPayload = {
string: 'value',
number: 1237,
@@ -188,7 +188,7 @@ describe('callApi()', () => {
});
});
- it('removes corrupt value when building formData with stringify = false', async () => {
+ test('removes corrupt value when building formData with stringify = false', async () => {
/*
There has been a case when 'stringify' is false an object value on one of the
attributes was missing a toString function making the cast to String() fail
@@ -228,7 +228,7 @@ describe('callApi()', () => {
});
describe('PUT requests', () => {
- it('encodes key,value pairs from postPayload', async () => {
+ test('encodes key,value pairs from postPayload', async () => {
expect.assertions(3);
const postPayload = { key: 'value', anotherKey: 1237 };
@@ -245,7 +245,7 @@ describe('callApi()', () => {
});
// the reason for this is to omit strings like 'undefined' from making their way to the backend
- it('omits key,value pairs from postPayload that have undefined values (PUT)', async () => {
+ test('omits key,value pairs from postPayload that have undefined values (PUT)', async () => {
expect.assertions(3);
const postPayload = { key: 'value', noValue: undefined };
@@ -259,7 +259,7 @@ describe('callApi()', () => {
expect(body.get('noValue')).toBeNull();
});
- it('respects the stringify flag in PUT requests', async () => {
+ test('respects the stringify flag in PUT requests', async () => {
const postPayload = {
string: 'value',
number: 1237,
@@ -294,7 +294,7 @@ describe('callApi()', () => {
});
describe('PATCH requests', () => {
- it('encodes key,value pairs from postPayload', async () => {
+ test('encodes key,value pairs from postPayload', async () => {
expect.assertions(3);
const postPayload = { key: 'value', anotherKey: 1237 };
@@ -311,7 +311,7 @@ describe('callApi()', () => {
});
// the reason for this is to omit strings like 'undefined' from making their way to the backend
- it('omits key,value pairs from postPayload that have undefined values (PATCH)', async () => {
+ test('omits key,value pairs from postPayload that have undefined values (PATCH)', async () => {
expect.assertions(3);
const postPayload = { key: 'value', noValue: undefined };
@@ -325,7 +325,7 @@ describe('callApi()', () => {
expect(body.get('noValue')).toBeNull();
});
- it('respects the stringify flag in PATCH requests', async () => {
+ test('respects the stringify flag in PATCH requests', async () => {
const postPayload = {
string: 'value',
number: 1237,
@@ -375,7 +375,7 @@ describe('callApi()', () => {
await caches.delete(constants.CACHE_KEY);
});
- it('caches requests with ETags', async () => {
+ test('caches requests with ETags', async () => {
expect.assertions(2);
await callApi({ url: mockCacheUrl, method: 'GET' });
const calls = fetchMock.callHistory.calls(mockCacheUrl);
@@ -385,7 +385,7 @@ describe('callApi()', () => {
expect(cachedResponse).toBeDefined();
});
- it('will not use cache when running off an insecure connection', async () => {
+ test('will not use cache when running off an insecure connection', async () => {
expect.assertions(2);
window.location.protocol = 'http:';
@@ -398,7 +398,7 @@ describe('callApi()', () => {
expect(cachedResponse).toBeUndefined();
});
- it('works when the Cache API is disabled', async () => {
+ test('works when the Cache API is disabled', async () => {
expect.assertions(5);
// eslint-disable-next-line no-import-assign
Object.defineProperty(constants, 'CACHE_AVAILABLE', { value: false });
@@ -425,7 +425,7 @@ describe('callApi()', () => {
Object.defineProperty(constants, 'CACHE_AVAILABLE', { value: true });
});
- it('sends known ETags in the If-None-Match header', async () => {
+ test('sends known ETags in the If-None-Match header', async () => {
expect.assertions(3);
// first call sets the cache
await callApi({ url: mockCacheUrl, method: 'GET' });
@@ -443,7 +443,7 @@ describe('callApi()', () => {
);
});
- it('reuses cached responses on 304 status', async () => {
+ test('reuses cached responses on 304 status', async () => {
expect.assertions(3);
// first call sets the cache
await callApi({ url: mockCacheUrl, method: 'GET' });
@@ -461,7 +461,7 @@ describe('callApi()', () => {
expect(secondBody).toEqual('BODY');
});
- it('throws error when cache fails on 304', async () => {
+ test('throws error when cache fails on 304', async () => {
expect.assertions(2);
// this should never happen, since a 304 is only returned if we have
@@ -484,7 +484,7 @@ describe('callApi()', () => {
}
});
- it('returns original response if no Etag', async () => {
+ test('returns original response if no Etag', async () => {
expect.assertions(3);
const url = mockGetUrl;
const response = await callApi({ url, method: 'GET' });
@@ -495,7 +495,7 @@ describe('callApi()', () => {
expect(body as typeof mockGetPayload).toEqual(mockGetPayload);
});
- it('returns original response if status not 304 or 200', async () => {
+ test('returns original response if status not 304 or 200', async () => {
expect.assertions(2);
const url = mockNotFound;
const response = await callApi({ url, method: 'GET' });
@@ -505,7 +505,7 @@ describe('callApi()', () => {
});
});
- it('rejects after retrying thrice if the request throws', async () => {
+ test('rejects after retrying thrice if the request throws', async () => {
expect.assertions(3);
let error;
try {
@@ -524,7 +524,7 @@ describe('callApi()', () => {
}
});
- it('rejects without retries if the config is set to 0 retries', async () => {
+ test('rejects without retries if the config is set to 0 retries', async () => {
expect.assertions(3);
let error;
try {
@@ -542,7 +542,7 @@ describe('callApi()', () => {
}
});
- it('rejects after retrying thrice if the request returns a 503', async () => {
+ test('rejects after retrying thrice if the request returns a 503', async () => {
expect.assertions(2);
const url = mock503;
const response = await callApi({
@@ -555,7 +555,7 @@ describe('callApi()', () => {
expect(response.status).toEqual(503);
});
- it('invalid json for postPayload should thrown error', async () => {
+ test('invalid json for postPayload should thrown error', async () => {
expect.assertions(2);
let error;
try {
@@ -572,7 +572,7 @@ describe('callApi()', () => {
}
});
- it('should accept search params object', async () => {
+ test('should accept search params object', async () => {
expect.assertions(3);
window.location.href = 'http://localhost';
fetchMock.get(`glob:*/get-search*`, { yes: 'ok' });
@@ -591,7 +591,7 @@ describe('callApi()', () => {
);
});
- it('should accept URLSearchParams', async () => {
+ test('should accept URLSearchParams', async () => {
expect.assertions(2);
window.location.href = 'http://localhost';
fetchMock.post(`glob:*/post-search*`, { yes: 'ok' });
@@ -613,7 +613,7 @@ describe('callApi()', () => {
);
});
- it('should throw when both payloads provided', async () => {
+ test('should throw when both payloads provided', async () => {
expect.assertions(1);
fetchMock.post('/post-both-payload', {});
@@ -634,7 +634,7 @@ describe('callApi()', () => {
}
});
- it('should accept FormData as postPayload', async () => {
+ test('should accept FormData as postPayload', async () => {
expect.assertions(1);
fetchMock.post('/post-formdata', {});
const payload = new FormData();
@@ -646,7 +646,7 @@ describe('callApi()', () => {
expect(fetchMock.callHistory.lastCall()?.options.body).toBe(payload);
});
- it('should ignore "null" postPayload string', async () => {
+ test('should ignore "null" postPayload string', async () => {
expect.assertions(1);
fetchMock.post('/post-null-postpayload', {});
fetchMock.post('/post-formdata', {});
diff --git a/superset-frontend/packages/superset-ui-core/test/connection/callApi/callApiAndParseWithTimeout.test.ts b/superset-frontend/packages/superset-ui-core/test/connection/callApi/callApiAndParseWithTimeout.test.ts
index a31dd48d348..f1afcc3017f 100644
--- a/superset-frontend/packages/superset-ui-core/test/connection/callApi/callApiAndParseWithTimeout.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/connection/callApi/callApiAndParseWithTimeout.test.ts
@@ -44,7 +44,7 @@ describe('callApiAndParseWithTimeout()', () => {
});
describe('callApi', () => {
- it('calls callApi()', () => {
+ test('calls callApi()', () => {
const callApiSpy = jest.spyOn(callApi, 'default');
callApiAndParseWithTimeout({ url: mockGetUrl, method: 'GET' });
@@ -54,7 +54,7 @@ describe('callApiAndParseWithTimeout()', () => {
});
describe('parseResponse', () => {
- it('calls parseResponse()', async () => {
+ test('calls parseResponse()', async () => {
const parseSpy = jest.spyOn(parseResponse, 'default');
await callApiAndParseWithTimeout({
@@ -68,7 +68,7 @@ describe('callApiAndParseWithTimeout()', () => {
});
describe('timeout', () => {
- it('does not create a rejection timer if no timeout passed', () => {
+ test('does not create a rejection timer if no timeout passed', () => {
const rejectionSpy = jest.spyOn(rejectAfterTimeout, 'default');
callApiAndParseWithTimeout({ url: mockGetUrl, method: 'GET' });
@@ -76,7 +76,7 @@ describe('callApiAndParseWithTimeout()', () => {
rejectionSpy.mockClear();
});
- it('creates a rejection timer if a timeout passed', () => {
+ test('creates a rejection timer if a timeout passed', () => {
jest.useFakeTimers(); // prevents the timeout from rejecting + failing test
const rejectionSpy = jest.spyOn(rejectAfterTimeout, 'default');
callApiAndParseWithTimeout({
@@ -89,7 +89,7 @@ describe('callApiAndParseWithTimeout()', () => {
rejectionSpy.mockClear();
});
- it('rejects if the request exceeds the timeout', async () => {
+ test('rejects if the request exceeds the timeout', async () => {
expect.assertions(2);
jest.useFakeTimers();
@@ -118,7 +118,7 @@ describe('callApiAndParseWithTimeout()', () => {
}
});
- it('resolves if the request does not exceed the timeout', async () => {
+ test('resolves if the request does not exceed the timeout', async () => {
expect.assertions(1);
const { json } = await callApiAndParseWithTimeout({
url: mockGetUrl,
diff --git a/superset-frontend/packages/superset-ui-core/test/connection/callApi/parseResponse.test.ts b/superset-frontend/packages/superset-ui-core/test/connection/callApi/parseResponse.test.ts
index 030c90f4a82..ff618d6dd59 100644
--- a/superset-frontend/packages/superset-ui-core/test/connection/callApi/parseResponse.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/connection/callApi/parseResponse.test.ts
@@ -50,13 +50,13 @@ describe('parseResponse()', () => {
afterEach(() => fetchMock.removeRoutes().clearHistory());
- it('returns a Promise', () => {
+ test('returns a Promise', () => {
const apiPromise = callApi({ url: mockGetUrl, method: 'GET' });
const parsedResponsePromise = parseResponse(apiPromise);
expect(parsedResponsePromise).toBeInstanceOf(Promise);
});
- it('resolves to { json, response } if the request succeeds', async () => {
+ test('resolves to { json, response } if the request succeeds', async () => {
expect.assertions(4);
const args = await parseResponse(
callApi({ url: mockGetUrl, method: 'GET' }),
@@ -70,7 +70,7 @@ describe('parseResponse()', () => {
);
});
- it('throws if `parseMethod=json` and .json() fails', async () => {
+ test('throws if `parseMethod=json` and .json() fails', async () => {
expect.assertions(3);
const mockTextUrl = '/mock/text/url';
@@ -90,7 +90,7 @@ describe('parseResponse()', () => {
}
});
- it('resolves to { text, response } if the `parseMethod=text`', async () => {
+ test('resolves to { text, response } if the `parseMethod=text`', async () => {
expect.assertions(4);
// test with json + bigint to ensure that it was not first parsed as json
@@ -109,7 +109,7 @@ describe('parseResponse()', () => {
expect(args.text).toBe(mockTextJsonResponse);
});
- it('throws if parseMethod is not null|json|text', async () => {
+ test('throws if parseMethod is not null|json|text', async () => {
expect.assertions(1);
let error;
@@ -127,7 +127,7 @@ describe('parseResponse()', () => {
}
});
- it('resolves to unmodified `Response` object if `parseMethod=null|raw`', async () => {
+ test('resolves to unmodified `Response` object if `parseMethod=null|raw`', async () => {
expect.assertions(3);
const responseNull = await parseResponse(
callApi({ url: mockNoParseUrl, method: 'GET' }),
@@ -142,7 +142,7 @@ describe('parseResponse()', () => {
expect(responseRaw.bodyUsed).toBe(false);
});
- it('resolves to big number value if `parseMethod=json-bigint`', async () => {
+ test('resolves to big number value if `parseMethod=json-bigint`', async () => {
const mockBigIntUrl = '/mock/get/bigInt';
const mockGetBigIntPayload = `{
"value": 9223372036854775807, "minus": { "value": -483729382918228373892, "str": "something" },
@@ -183,7 +183,7 @@ describe('parseResponse()', () => {
expect(responseBigNumber.json.constructor).toEqual('constructor');
});
- it('rejects if request.ok=false', async () => {
+ test('rejects if request.ok=false', async () => {
expect.assertions(3);
const mockNotOkayUrl = '/mock/notokay/url';
fetchMock.get(mockNotOkayUrl, 404); // 404s result in not response.ok=false
diff --git a/superset-frontend/packages/superset-ui-core/test/connection/callApi/rejectAfterTimeout.test.ts b/superset-frontend/packages/superset-ui-core/test/connection/callApi/rejectAfterTimeout.test.ts
index 9be808dc29e..cbd18d40d18 100644
--- a/superset-frontend/packages/superset-ui-core/test/connection/callApi/rejectAfterTimeout.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/connection/callApi/rejectAfterTimeout.test.ts
@@ -19,7 +19,7 @@
import rejectAfterTimeout from '../../../src/connection/callApi/rejectAfterTimeout';
describe('rejectAfterTimeout()', () => {
- it('returns a promise that rejects after the specified timeout', async () => {
+ test('returns a promise that rejects after the specified timeout', async () => {
expect.assertions(1);
jest.useFakeTimers();
let error;
diff --git a/superset-frontend/packages/superset-ui-core/test/dimension/computeMaxFontSize.test.ts b/superset-frontend/packages/superset-ui-core/test/dimension/computeMaxFontSize.test.ts
index a64d819535c..3ad9f5b942f 100644
--- a/superset-frontend/packages/superset-ui-core/test/dimension/computeMaxFontSize.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/dimension/computeMaxFontSize.test.ts
@@ -25,14 +25,14 @@ describe('computeMaxFontSize(input)', () => {
beforeEach(addDummyFill);
afterEach(removeDummyFill);
- it('requires either idealFontSize or maxHeight', () => {
+ test('requires either idealFontSize or maxHeight', () => {
expect(() => {
computeMaxFontSize({
text: SAMPLE_TEXT[0],
});
}).toThrow();
});
- it('computes maximum font size for given maxWidth and maxHeight', () => {
+ test('computes maximum font size for given maxWidth and maxHeight', () => {
expect(
computeMaxFontSize({
maxWidth: 400,
@@ -41,7 +41,7 @@ describe('computeMaxFontSize(input)', () => {
}),
).toEqual(30);
});
- it('computes maximum font size for given idealFontSize and maxHeight', () => {
+ test('computes maximum font size for given idealFontSize and maxHeight', () => {
expect(
computeMaxFontSize({
maxHeight: 20,
@@ -50,7 +50,7 @@ describe('computeMaxFontSize(input)', () => {
}),
).toEqual(20);
});
- it('computes maximum font size for given maxWidth and idealFontSize', () => {
+ test('computes maximum font size for given maxWidth and idealFontSize', () => {
expect(
computeMaxFontSize({
maxWidth: 250,
@@ -59,7 +59,7 @@ describe('computeMaxFontSize(input)', () => {
}),
).toEqual(25);
});
- it('ensure idealFontSize is used if the maximum font size calculation goes below zero', () => {
+ test('ensure idealFontSize is used if the maximum font size calculation goes below zero', () => {
expect(
computeMaxFontSize({
maxWidth: 5,
diff --git a/superset-frontend/packages/superset-ui-core/test/dimension/getMultipleTextDimensions.test.ts b/superset-frontend/packages/superset-ui-core/test/dimension/getMultipleTextDimensions.test.ts
index 687c2d9c2b9..13423678911 100644
--- a/superset-frontend/packages/superset-ui-core/test/dimension/getMultipleTextDimensions.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/dimension/getMultipleTextDimensions.test.ts
@@ -25,7 +25,7 @@ describe('getMultipleTextDimension(input)', () => {
beforeEach(addDummyFill);
afterEach(removeDummyFill);
- it('takes an array of text as argument', () => {
+ test('takes an array of text as argument', () => {
expect(
getMultipleTextDimensions({
texts: [SAMPLE_TEXT[0], SAMPLE_TEXT[1], ''],
@@ -45,7 +45,7 @@ describe('getMultipleTextDimension(input)', () => {
},
]);
});
- it('handles empty text', () => {
+ test('handles empty text', () => {
expect(
getMultipleTextDimensions({
texts: ['', ''],
@@ -61,7 +61,7 @@ describe('getMultipleTextDimension(input)', () => {
},
]);
});
- it('handles duplicate text', () => {
+ test('handles duplicate text', () => {
expect(
getMultipleTextDimensions({
texts: [SAMPLE_TEXT[0], SAMPLE_TEXT[0]],
@@ -77,7 +77,7 @@ describe('getMultipleTextDimension(input)', () => {
},
]);
});
- it('accepts provided class via className', () => {
+ test('accepts provided class via className', () => {
expect(
getMultipleTextDimensions({
texts: [SAMPLE_TEXT[0], SAMPLE_TEXT[1]],
@@ -94,7 +94,7 @@ describe('getMultipleTextDimension(input)', () => {
},
]);
});
- it('accepts provided style.font', () => {
+ test('accepts provided style.font', () => {
expect(
getMultipleTextDimensions({
texts: [SAMPLE_TEXT[0], SAMPLE_TEXT[1]],
@@ -113,7 +113,7 @@ describe('getMultipleTextDimension(input)', () => {
},
]);
});
- it('accepts provided style.fontFamily', () => {
+ test('accepts provided style.fontFamily', () => {
expect(
getMultipleTextDimensions({
texts: [SAMPLE_TEXT[0], SAMPLE_TEXT[1]],
@@ -132,7 +132,7 @@ describe('getMultipleTextDimension(input)', () => {
},
]);
});
- it('accepts provided style.fontSize', () => {
+ test('accepts provided style.fontSize', () => {
expect(
getMultipleTextDimensions({
texts: [SAMPLE_TEXT[0], SAMPLE_TEXT[1]],
@@ -151,7 +151,7 @@ describe('getMultipleTextDimension(input)', () => {
},
]);
});
- it('accepts provided style.fontStyle', () => {
+ test('accepts provided style.fontStyle', () => {
expect(
getMultipleTextDimensions({
texts: [SAMPLE_TEXT[0], SAMPLE_TEXT[1]],
@@ -170,7 +170,7 @@ describe('getMultipleTextDimension(input)', () => {
},
]);
});
- it('accepts provided style.fontWeight', () => {
+ test('accepts provided style.fontWeight', () => {
expect(
getMultipleTextDimensions({
texts: [SAMPLE_TEXT[0], SAMPLE_TEXT[1]],
@@ -189,7 +189,7 @@ describe('getMultipleTextDimension(input)', () => {
},
]);
});
- it('accepts provided style.letterSpacing', () => {
+ test('accepts provided style.letterSpacing', () => {
expect(
getMultipleTextDimensions({
texts: [SAMPLE_TEXT[0], SAMPLE_TEXT[1]],
@@ -209,7 +209,7 @@ describe('getMultipleTextDimension(input)', () => {
]);
});
});
- it('cleans up DOM', async () => {
+ test('cleans up DOM', async () => {
getMultipleTextDimensions({
texts: [SAMPLE_TEXT[0], SAMPLE_TEXT[1]],
});
diff --git a/superset-frontend/packages/superset-ui-core/test/dimension/getTextDimension.test.ts b/superset-frontend/packages/superset-ui-core/test/dimension/getTextDimension.test.ts
index def5c213fa2..9fd22ac9b79 100644
--- a/superset-frontend/packages/superset-ui-core/test/dimension/getTextDimension.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/dimension/getTextDimension.test.ts
@@ -22,7 +22,7 @@ import { addDummyFill, removeDummyFill, SAMPLE_TEXT } from './getBBoxDummyFill';
describe('getTextDimension(input)', () => {
describe('returns default dimension if getBBox() is not available', () => {
- it('returns default value for default dimension', () => {
+ test('returns default value for default dimension', () => {
expect(
getTextDimension({
text: SAMPLE_TEXT[0],
@@ -32,7 +32,7 @@ describe('getTextDimension(input)', () => {
width: 100,
});
});
- it('return specified value if specified', () => {
+ test('return specified value if specified', () => {
expect(
getTextDimension(
{
@@ -53,7 +53,7 @@ describe('getTextDimension(input)', () => {
beforeEach(addDummyFill);
afterEach(removeDummyFill);
- it('takes text as argument', () => {
+ test('takes text as argument', () => {
expect(
getTextDimension({
text: SAMPLE_TEXT[0],
@@ -63,7 +63,7 @@ describe('getTextDimension(input)', () => {
width: 200,
});
});
- it('accepts provided class via className', () => {
+ test('accepts provided class via className', () => {
expect(
getTextDimension({
text: SAMPLE_TEXT[0],
@@ -74,7 +74,7 @@ describe('getTextDimension(input)', () => {
width: 100, // width is 100 after adding class
});
});
- it('accepts provided style.font', () => {
+ test('accepts provided style.font', () => {
expect(
getTextDimension({
text: SAMPLE_TEXT[0],
@@ -87,7 +87,7 @@ describe('getTextDimension(input)', () => {
width: 1125, // 250 [fontFamily=Lobster] * (30/20) [fontSize=30] * 1.5 [fontStyle=italic] * 2 [fontWeight=700]
});
});
- it('accepts provided style.fontFamily', () => {
+ test('accepts provided style.fontFamily', () => {
expect(
getTextDimension({
text: SAMPLE_TEXT[0],
@@ -100,7 +100,7 @@ describe('getTextDimension(input)', () => {
width: 250, // (250 [fontFamily=Lobster]
});
});
- it('accepts provided style.fontSize', () => {
+ test('accepts provided style.fontSize', () => {
expect(
getTextDimension({
text: SAMPLE_TEXT[0],
@@ -113,7 +113,7 @@ describe('getTextDimension(input)', () => {
width: 400, // 200 [baseWidth] * (40/20) [fontSize=40]
});
});
- it('accepts provided style.fontStyle', () => {
+ test('accepts provided style.fontStyle', () => {
expect(
getTextDimension({
text: SAMPLE_TEXT[0],
@@ -126,7 +126,7 @@ describe('getTextDimension(input)', () => {
width: 300, // 200 [baseWidth] * 1.5 [fontStyle=italic]
});
});
- it('accepts provided style.fontWeight', () => {
+ test('accepts provided style.fontWeight', () => {
expect(
getTextDimension({
text: SAMPLE_TEXT[0],
@@ -139,7 +139,7 @@ describe('getTextDimension(input)', () => {
width: 400, // 200 [baseWidth] * 2 [fontWeight=700]
});
});
- it('accepts provided style.letterSpacing', () => {
+ test('accepts provided style.letterSpacing', () => {
expect(
getTextDimension({
text: SAMPLE_TEXT[0],
@@ -152,7 +152,7 @@ describe('getTextDimension(input)', () => {
width: 221, // Ceiling(200 [baseWidth] * 1.1 [letterSpacing=1.1])
});
});
- it('handle empty text', () => {
+ test('handle empty text', () => {
expect(
getTextDimension({
text: '',
@@ -163,7 +163,7 @@ describe('getTextDimension(input)', () => {
});
});
});
- it('cleans up DOM', async () => {
+ test('cleans up DOM', async () => {
getTextDimension({
text: SAMPLE_TEXT[0],
});
diff --git a/superset-frontend/packages/superset-ui-core/test/dimension/mergeMargin.test.ts b/superset-frontend/packages/superset-ui-core/test/dimension/mergeMargin.test.ts
index 86e9194efe0..2d534fded4d 100644
--- a/superset-frontend/packages/superset-ui-core/test/dimension/mergeMargin.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/dimension/mergeMargin.test.ts
@@ -20,7 +20,7 @@
import { mergeMargin } from '@superset-ui/core';
describe('mergeMargin(margin1, margin2, mode?)', () => {
- it('combines two given margin', () => {
+ test('combines two given margin', () => {
expect(
mergeMargin(
{
@@ -44,7 +44,7 @@ describe('mergeMargin(margin1, margin2, mode?)', () => {
});
});
describe('default values', () => {
- it('works if margin1 is not defined', () => {
+ test('works if margin1 is not defined', () => {
expect(
mergeMargin(undefined, {
top: 2,
@@ -59,7 +59,7 @@ describe('mergeMargin(margin1, margin2, mode?)', () => {
right: 1,
});
});
- it('works if margin2 is not defined', () => {
+ test('works if margin2 is not defined', () => {
expect(
mergeMargin(
{
@@ -77,7 +77,7 @@ describe('mergeMargin(margin1, margin2, mode?)', () => {
right: 2,
});
});
- it('use 0 for the side that is not specified', () => {
+ test('use 0 for the side that is not specified', () => {
expect(mergeMargin({}, {})).toEqual({
top: 0,
left: 0,
@@ -87,7 +87,7 @@ describe('mergeMargin(margin1, margin2, mode?)', () => {
});
});
describe('mode', () => {
- it('if mode=expand, returns the larger margin for each side', () => {
+ test('if mode=expand, returns the larger margin for each side', () => {
expect(
mergeMargin(
{
@@ -111,7 +111,7 @@ describe('mergeMargin(margin1, margin2, mode?)', () => {
right: 2,
});
});
- it('if mode=shrink, returns the smaller margin for each side', () => {
+ test('if mode=shrink, returns the smaller margin for each side', () => {
expect(
mergeMargin(
{
@@ -135,7 +135,7 @@ describe('mergeMargin(margin1, margin2, mode?)', () => {
right: 1,
});
});
- it('expand by default', () => {
+ test('expand by default', () => {
expect(
mergeMargin(
{
@@ -159,7 +159,7 @@ describe('mergeMargin(margin1, margin2, mode?)', () => {
});
});
});
- it('works correctly for negative margins', () => {
+ test('works correctly for negative margins', () => {
expect(
mergeMargin(
{
@@ -182,7 +182,7 @@ describe('mergeMargin(margin1, margin2, mode?)', () => {
right: -1,
});
});
- it('if there are NaN or null, use another value', () => {
+ test('if there are NaN or null, use another value', () => {
expect(
mergeMargin(
{
diff --git a/superset-frontend/packages/superset-ui-core/test/dimension/parseLength.test.ts b/superset-frontend/packages/superset-ui-core/test/dimension/parseLength.test.ts
index 60c1663b46e..d77a97908f5 100644
--- a/superset-frontend/packages/superset-ui-core/test/dimension/parseLength.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/dimension/parseLength.test.ts
@@ -20,28 +20,28 @@
import { parseLength } from '@superset-ui/core';
describe('parseLength(input)', () => {
- it('handles string "auto"', () => {
+ test('handles string "auto"', () => {
expect(parseLength('auto')).toEqual({ isDynamic: true, multiplier: 1 });
});
- it('handles strings with % at the end', () => {
+ test('handles strings with % at the end', () => {
expect(parseLength('100%')).toEqual({ isDynamic: true, multiplier: 1 });
expect(parseLength('50%')).toEqual({ isDynamic: true, multiplier: 0.5 });
expect(parseLength('0%')).toEqual({ isDynamic: true, multiplier: 0 });
});
- it('handles strings that are numbers with px at the end', () => {
+ test('handles strings that are numbers with px at the end', () => {
expect(parseLength('100px')).toEqual({ isDynamic: false, value: 100 });
expect(parseLength('20.5px')).toEqual({ isDynamic: false, value: 20.5 });
});
- it('handles strings that are numbers', () => {
+ test('handles strings that are numbers', () => {
expect(parseLength('100')).toEqual({ isDynamic: false, value: 100 });
expect(parseLength('40.5')).toEqual({ isDynamic: false, value: 40.5 });
expect(parseLength('20.0')).toEqual({ isDynamic: false, value: 20 });
});
- it('handles numbers', () => {
+ test('handles numbers', () => {
expect(parseLength(100)).toEqual({ isDynamic: false, value: 100 });
expect(parseLength(0)).toEqual({ isDynamic: false, value: 0 });
});
diff --git a/superset-frontend/packages/superset-ui-core/test/dimension/svg/LazyFactory.test.ts b/superset-frontend/packages/superset-ui-core/test/dimension/svg/LazyFactory.test.ts
index 8e0bac5a717..34dd03faa92 100644
--- a/superset-frontend/packages/superset-ui-core/test/dimension/svg/LazyFactory.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/dimension/svg/LazyFactory.test.ts
@@ -21,14 +21,14 @@ import LazyFactory from '../../../src/dimension/svg/LazyFactory';
describe('LazyFactory', () => {
describe('createInContainer()', () => {
- it('creates node in the specified container', () => {
+ test('creates node in the specified container', () => {
const factory = new LazyFactory(() => document.createElement('div'));
const div = factory.createInContainer();
const innerDiv = factory.createInContainer(div);
expect(div.parentNode).toEqual(document.body);
expect(innerDiv.parentNode).toEqual(div);
});
- it('reuses existing', () => {
+ test('reuses existing', () => {
const factoryFn = jest.fn(() => document.createElement('div'));
const factory = new LazyFactory(factoryFn);
const div1 = factory.createInContainer();
@@ -38,7 +38,7 @@ describe('LazyFactory', () => {
});
});
describe('removeFromContainer', () => {
- it('removes node from container', () => {
+ test('removes node from container', () => {
const factory = new LazyFactory(() => document.createElement('div'));
const div = factory.createInContainer();
const innerDiv = factory.createInContainer(div);
@@ -49,7 +49,7 @@ describe('LazyFactory', () => {
expect(div.parentNode).toBeNull();
expect(innerDiv.parentNode).toBeNull();
});
- it('does not remove if others are using', () => {
+ test('does not remove if others are using', () => {
const factory = new LazyFactory(() => document.createElement('div'));
const div1 = factory.createInContainer();
factory.createInContainer();
@@ -58,7 +58,7 @@ describe('LazyFactory', () => {
factory.removeFromContainer();
expect(div1.parentNode).toBeNull();
});
- it('does not crash if try to remove already removed node', () => {
+ test('does not crash if try to remove already removed node', () => {
const factory = new LazyFactory(() => document.createElement('div'));
factory.createInContainer();
factory.removeFromContainer();
diff --git a/superset-frontend/packages/superset-ui-core/test/dimension/svg/getBBoxCeil.test.ts b/superset-frontend/packages/superset-ui-core/test/dimension/svg/getBBoxCeil.test.ts
index 047a79dd024..db5aaa23079 100644
--- a/superset-frontend/packages/superset-ui-core/test/dimension/svg/getBBoxCeil.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/dimension/svg/getBBoxCeil.test.ts
@@ -22,13 +22,13 @@ import createTextNode from '../../../src/dimension/svg/createTextNode';
describe('getBBoxCeil(node, defaultDimension)', () => {
describe('returns default dimension if getBBox() is not available', () => {
- it('returns default value for default dimension', () => {
+ test('returns default value for default dimension', () => {
expect(getBBoxCeil(createTextNode())).toEqual({
height: 20,
width: 100,
});
});
- it('return specified value if specified', () => {
+ test('return specified value if specified', () => {
expect(
getBBoxCeil(createTextNode(), {
height: 30,
@@ -41,7 +41,7 @@ describe('getBBoxCeil(node, defaultDimension)', () => {
});
});
describe('returns ceiling of the svg element', () => {
- it('converts to ceiling if value is not integer', () => {
+ test('converts to ceiling if value is not integer', () => {
expect(
getBBoxCeil(createTextNode(), { height: 10.6, width: 11.1 }),
).toEqual({
@@ -50,7 +50,7 @@ describe('getBBoxCeil(node, defaultDimension)', () => {
});
});
- it('does nothing if value is integer', () => {
+ test('does nothing if value is integer', () => {
expect(getBBoxCeil(createTextNode())).toEqual({
height: 20,
width: 100,
diff --git a/superset-frontend/packages/superset-ui-core/test/dimension/svg/updateTextNode.test.ts b/superset-frontend/packages/superset-ui-core/test/dimension/svg/updateTextNode.test.ts
index 8b1cdb14632..ae1cb835523 100644
--- a/superset-frontend/packages/superset-ui-core/test/dimension/svg/updateTextNode.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/dimension/svg/updateTextNode.test.ts
@@ -26,7 +26,7 @@ import updateTextNode from '../../../src/dimension/svg/updateTextNode';
import createTextNode from '../../../src/dimension/svg/createTextNode';
describe('updateTextNode(node, options)', () => {
- it('handles empty options', () => {
+ test('handles empty options', () => {
const node = updateTextNode(createTextNode());
expect(node.getAttribute('class')).toEqual('');
expect(node.style.font).toEqual('');
@@ -38,7 +38,7 @@ describe('updateTextNode(node, options)', () => {
expect(node.textContent).toEqual('');
});
- it('handles setting class', () => {
+ test('handles setting class', () => {
const node = updateTextNode(createTextNode(), { className: 'abc' });
expect(node.getAttribute('class')).toEqual('abc');
expect(node.style.font).toEqual('');
@@ -50,7 +50,7 @@ describe('updateTextNode(node, options)', () => {
expect(node.textContent).toEqual('');
});
- it('handles setting text', () => {
+ test('handles setting text', () => {
const node = updateTextNode(createTextNode(), { text: 'abc' });
expect(node.getAttribute('class')).toEqual('');
expect(node.style.font).toEqual('');
@@ -62,7 +62,7 @@ describe('updateTextNode(node, options)', () => {
expect(node.textContent).toEqual('abc');
});
- it('handles setting font', () => {
+ test('handles setting font', () => {
const node = updateTextNode(createTextNode(), {
style: {
font: 'italic 30px Lobster 700',
@@ -77,7 +77,7 @@ describe('updateTextNode(node, options)', () => {
expect(node.textContent).toEqual('');
});
- it('handles setting specific font style', () => {
+ test('handles setting specific font style', () => {
const node = updateTextNode(createTextNode(), {
style: {
fontFamily: 'Lobster',
diff --git a/superset-frontend/packages/superset-ui-core/test/dynamic-plugins/shared-modules.test.ts b/superset-frontend/packages/superset-ui-core/test/dynamic-plugins/shared-modules.test.ts
index ea993d00f81..26968985c6e 100644
--- a/superset-frontend/packages/superset-ui-core/test/dynamic-plugins/shared-modules.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/dynamic-plugins/shared-modules.test.ts
@@ -24,7 +24,7 @@ describe('shared modules', () => {
reset();
});
- it('assigns to window', async () => {
+ test('assigns to window', async () => {
const fakeModule = { foo: 'bar' };
const fetchModule = jest.fn().mockResolvedValue(fakeModule);
@@ -35,7 +35,7 @@ describe('shared modules', () => {
);
});
- it('resolves to the same reference every time', async () => {
+ test('resolves to the same reference every time', async () => {
const fakeModule = { foo: 'bar' };
const fetchModule = jest.fn().mockResolvedValue(fakeModule);
@@ -46,7 +46,7 @@ describe('shared modules', () => {
expect(result2).toStrictEqual(fakeModule);
});
- it('does not redefine unnecessarily', async () => {
+ test('does not redefine unnecessarily', async () => {
const fakeModule = { foo: 'bar' };
const fetchModule = jest.fn().mockResolvedValue(fakeModule);
const duplicateFetchModule = jest.fn().mockResolvedValue(fakeModule);
@@ -62,7 +62,7 @@ describe('shared modules', () => {
expect(duplicateFetchModule).not.toHaveBeenCalled();
});
- it('deduplicates in-progress definitions', async () => {
+ test('deduplicates in-progress definitions', async () => {
const fakeModule = { foo: 'bar' };
// get a promise that actually takes a moment;
const fetchModule = jest
@@ -79,7 +79,7 @@ describe('shared modules', () => {
expect(result1).toStrictEqual(result2);
});
- it('shares a map of modules', async () => {
+ test('shares a map of modules', async () => {
const foo = { foo: 'bar' };
const fizz = { fizz: 'buzz' };
await defineSharedModules({
diff --git a/superset-frontend/packages/superset-ui-core/test/index.test.ts b/superset-frontend/packages/superset-ui-core/test/index.test.ts
index 68fdd65be29..f1d337940ba 100644
--- a/superset-frontend/packages/superset-ui-core/test/index.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/index.test.ts
@@ -30,7 +30,7 @@ import {
} from '@superset-ui/core';
describe('index', () => {
- it('exports modules', () => {
+ test('exports modules', () => {
[
ExtensibleFunction,
Plugin,
diff --git a/superset-frontend/packages/superset-ui-core/test/models/ExtensibleFunction.test.ts b/superset-frontend/packages/superset-ui-core/test/models/ExtensibleFunction.test.ts
index 2a52d0bfb5b..384b75031c2 100644
--- a/superset-frontend/packages/superset-ui-core/test/models/ExtensibleFunction.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/models/ExtensibleFunction.test.ts
@@ -63,7 +63,7 @@ describe('ExtensibleFunction', () => {
}
}
- it('its subclass is an instance of Function', () => {
+ test('its subclass is an instance of Function', () => {
expect(Func1).toBeInstanceOf(Function);
expect(Func2).toBeInstanceOf(Function);
expect(Func3).toBeInstanceOf(Function);
@@ -73,17 +73,17 @@ describe('ExtensibleFunction', () => {
const func2 = new Func2(100);
const func3 = new Func3(100);
- it('an instance of its subclass is executable like regular function', () => {
+ test('an instance of its subclass is executable like regular function', () => {
expect(func1()).toEqual(100);
expect(func2()).toEqual(100);
});
- it('its subclass behaves like regular class with its own fields and functions', () => {
+ test('its subclass behaves like regular class with its own fields and functions', () => {
expect(func2.x).toEqual(100);
expect(func2.hi()).toEqual('hi');
});
- it('its subclass can set name by passing named function to its constructor', () => {
+ test('its subclass can set name by passing named function to its constructor', () => {
expect(func3.name).toEqual('customName');
});
});
diff --git a/superset-frontend/packages/superset-ui-core/test/models/Plugin.test.ts b/superset-frontend/packages/superset-ui-core/test/models/Plugin.test.ts
index 68d9c0b375e..7c982f5104c 100644
--- a/superset-frontend/packages/superset-ui-core/test/models/Plugin.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/models/Plugin.test.ts
@@ -20,58 +20,58 @@
import { Plugin } from '@superset-ui/core';
describe('Plugin', () => {
- it('exists', () => {
+ test('exists', () => {
expect(Plugin).toBeDefined();
});
describe('new Plugin()', () => {
- it('creates a new plugin', () => {
+ test('creates a new plugin', () => {
const plugin = new Plugin();
expect(plugin).toBeInstanceOf(Plugin);
});
});
describe('.configure(config, replace)', () => {
- it('extends the default config with given config when replace is not set or false', () => {
+ test('extends the default config with given config when replace is not set or false', () => {
const plugin = new Plugin();
plugin.configure({ key: 'abc', foo: 'bar' });
plugin.configure({ key: 'def' });
expect(plugin.config).toEqual({ key: 'def', foo: 'bar' });
});
- it('replaces the default config with given config when replace is true', () => {
+ test('replaces the default config with given config when replace is true', () => {
const plugin = new Plugin();
plugin.configure({ key: 'abc', foo: 'bar' });
plugin.configure({ key: 'def' }, true);
expect(plugin.config).toEqual({ key: 'def' });
});
- it('returns the plugin itself', () => {
+ test('returns the plugin itself', () => {
const plugin = new Plugin();
expect(plugin.configure({ key: 'abc' })).toBe(plugin);
});
});
describe('.resetConfig()', () => {
- it('resets config back to default', () => {
+ test('resets config back to default', () => {
const plugin = new Plugin();
plugin.configure({ key: 'abc', foo: 'bar' });
plugin.resetConfig();
expect(plugin.config).toEqual({});
});
- it('returns the plugin itself', () => {
+ test('returns the plugin itself', () => {
const plugin = new Plugin();
expect(plugin.resetConfig()).toBe(plugin);
});
});
describe('.register()', () => {
- it('returns the plugin itself', () => {
+ test('returns the plugin itself', () => {
const plugin = new Plugin();
expect(plugin.register()).toBe(plugin);
});
});
describe('.unregister()', () => {
- it('returns the plugin itself', () => {
+ test('returns the plugin itself', () => {
const plugin = new Plugin();
expect(plugin.unregister()).toBe(plugin);
});
diff --git a/superset-frontend/packages/superset-ui-core/test/models/Preset.test.ts b/superset-frontend/packages/superset-ui-core/test/models/Preset.test.ts
index 188983de794..14d3ef6b39e 100644
--- a/superset-frontend/packages/superset-ui-core/test/models/Preset.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/models/Preset.test.ts
@@ -20,19 +20,19 @@
import { Plugin, Preset } from '@superset-ui/core';
describe('Preset', () => {
- it('exists', () => {
+ test('exists', () => {
expect(Preset).toBeDefined();
});
describe('new Preset()', () => {
- it('creates new preset', () => {
+ test('creates new preset', () => {
const preset = new Preset();
expect(preset).toBeInstanceOf(Preset);
});
});
describe('.register()', () => {
- it('register all listed presets then plugins', () => {
+ test('register all listed presets then plugins', () => {
const values: number[] = [];
class Plugin1 extends Plugin {
register() {
@@ -78,7 +78,7 @@ describe('Preset', () => {
expect(values).toEqual([1, 2, 3, 9]);
});
- it('returns itself', () => {
+ test('returns itself', () => {
const preset = new Preset();
expect(preset.register()).toBe(preset);
});
diff --git a/superset-frontend/packages/superset-ui-core/test/models/Registry.test.ts b/superset-frontend/packages/superset-ui-core/test/models/Registry.test.ts
index 7b3f2d1f89e..f8e041f07af 100644
--- a/superset-frontend/packages/superset-ui-core/test/models/Registry.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/models/Registry.test.ts
@@ -24,16 +24,16 @@ import { Registry, OverwritePolicy } from '@superset-ui/core';
const loader = () => 'testValue';
describe('Registry', () => {
- it('exists', () => {
+ test('exists', () => {
expect(Registry !== undefined).toBe(true);
});
describe('new Registry(config)', () => {
- it('can create a new registry when config.name is not given', () => {
+ test('can create a new registry when config.name is not given', () => {
const registry = new Registry();
expect(registry).toBeInstanceOf(Registry);
});
- it('can create a new registry when config.name is given', () => {
+ test('can create a new registry when config.name is given', () => {
const registry = new Registry({ name: 'abc' });
expect(registry).toBeInstanceOf(Registry);
expect(registry.name).toBe('abc');
@@ -41,41 +41,41 @@ describe('Registry', () => {
});
describe('.clear()', () => {
- it('clears all registered items', () => {
+ test('clears all registered items', () => {
const registry = new Registry();
registry.registerValue('a', 'testValue');
registry.clear();
expect(Object.keys(registry.items)).toHaveLength(0);
expect(Object.keys(registry.promises)).toHaveLength(0);
});
- it('returns the registry itself', () => {
+ test('returns the registry itself', () => {
const registry = new Registry();
expect(registry.clear()).toBe(registry);
});
});
describe('.has(key)', () => {
- it('returns true if an item with the given key exists', () => {
+ test('returns true if an item with the given key exists', () => {
const registry = new Registry();
registry.registerValue('a', 'testValue');
expect(registry.has('a')).toBe(true);
registry.registerLoader('b', () => 'testValue2');
expect(registry.has('b')).toBe(true);
});
- it('returns false if an item with the given key does not exist', () => {
+ test('returns false if an item with the given key does not exist', () => {
const registry = new Registry();
expect(registry.has('a')).toBe(false);
});
});
describe('.registerValue(key, value)', () => {
- it('registers the given value with the given key', () => {
+ test('registers the given value with the given key', () => {
const registry = new Registry();
registry.registerValue('a', 'testValue');
expect(registry.has('a')).toBe(true);
expect(registry.get('a')).toBe('testValue');
});
- it('does not overwrite if value is exactly the same', () => {
+ test('does not overwrite if value is exactly the same', () => {
const registry = new Registry();
const value = { a: 1 };
registry.registerValue('a', value);
@@ -87,27 +87,27 @@ describe('Registry', () => {
const promise3 = registry.getAsPromise('a');
expect(promise1).not.toBe(promise3);
});
- it('overwrites item with loader', () => {
+ test('overwrites item with loader', () => {
const registry = new Registry();
registry.registerLoader('a', () => 'ironman');
expect(registry.get('a')).toBe('ironman');
registry.registerValue('a', 'hulk');
expect(registry.get('a')).toBe('hulk');
});
- it('returns the registry itself', () => {
+ test('returns the registry itself', () => {
const registry = new Registry();
expect(registry.registerValue('a', 'testValue')).toBe(registry);
});
});
describe('.registerLoader(key, loader)', () => {
- it('registers the given loader with the given key', () => {
+ test('registers the given loader with the given key', () => {
const registry = new Registry();
registry.registerLoader('a', () => 'testValue');
expect(registry.has('a')).toBe(true);
expect(registry.get('a')).toBe('testValue');
});
- it('does not overwrite if loader is exactly the same', () => {
+ test('does not overwrite if loader is exactly the same', () => {
const registry = new Registry();
registry.registerLoader('a', loader);
const promise1 = registry.getAsPromise('a');
@@ -118,35 +118,35 @@ describe('Registry', () => {
const promise3 = registry.getAsPromise('a');
expect(promise1).not.toBe(promise3);
});
- it('overwrites item with value', () => {
+ test('overwrites item with value', () => {
const registry = new Registry();
registry.registerValue('a', 'hulk');
expect(registry.get('a')).toBe('hulk');
registry.registerLoader('a', () => 'ironman');
expect(registry.get('a')).toBe('ironman');
});
- it('returns the registry itself', () => {
+ test('returns the registry itself', () => {
const registry = new Registry();
expect(registry.registerLoader('a', () => 'testValue')).toBe(registry);
});
});
describe('.get(key)', () => {
- it('given the key, returns the value if the item is a value', () => {
+ test('given the key, returns the value if the item is a value', () => {
const registry = new Registry();
registry.registerValue('a', 'testValue');
expect(registry.get('a')).toBe('testValue');
});
- it('given the key, returns the result of the loader function if the item is a loader', () => {
+ test('given the key, returns the result of the loader function if the item is a loader', () => {
const registry = new Registry();
registry.registerLoader('b', () => 'testValue2');
expect(registry.get('b')).toBe('testValue2');
});
- it('returns undefined if the item with specified key does not exist', () => {
+ test('returns undefined if the item with specified key does not exist', () => {
const registry = new Registry();
expect(registry.get('a')).toBeUndefined();
});
- it('If the key was registered multiple times, returns the most recent item.', () => {
+ test('If the key was registered multiple times, returns the most recent item.', () => {
const registry = new Registry();
registry.registerValue('a', 'testValue');
expect(registry.get('a')).toBe('testValue');
@@ -156,7 +156,7 @@ describe('Registry', () => {
});
describe('.getAsPromise(key)', () => {
- it('given the key, returns a promise of item value if the item is a value', () => {
+ test('given the key, returns a promise of item value if the item is a value', () => {
const registry = new Registry();
registry.registerValue('a', 'testValue');
@@ -164,7 +164,7 @@ describe('Registry', () => {
.getAsPromise('a')
.then(value => expect(value).toBe('testValue'));
});
- it('given the key, returns a promise of result of the loader function if the item is a loader', () => {
+ test('given the key, returns a promise of result of the loader function if the item is a loader', () => {
const registry = new Registry();
registry.registerLoader('a', () => 'testValue');
@@ -172,14 +172,14 @@ describe('Registry', () => {
.getAsPromise('a')
.then(value => expect(value).toBe('testValue'));
});
- it('returns same promise object for the same key unless user re-registers new value with the key.', () => {
+ test('returns same promise object for the same key unless user re-registers new value with the key.', () => {
const registry = new Registry();
registry.registerLoader('a', () => 'testValue');
const promise1 = registry.getAsPromise('a');
const promise2 = registry.getAsPromise('a');
expect(promise1).toBe(promise2);
});
- it('returns a rejected promise if the item with specified key does not exist', () => {
+ test('returns a rejected promise if the item with specified key does not exist', () => {
const registry = new Registry();
return registry.getAsPromise('a').then(null, (err: Error) => {
@@ -188,7 +188,7 @@ describe('Registry', () => {
);
});
});
- it('If the key was registered multiple times, returns a promise of the most recent item.', async () => {
+ test('If the key was registered multiple times, returns a promise of the most recent item.', async () => {
const registry = new Registry();
registry.registerValue('a', 'testValue');
expect(await registry.getAsPromise('a')).toBe('testValue');
@@ -198,7 +198,7 @@ describe('Registry', () => {
});
describe('.getMap()', () => {
- it('returns key-value map as plain object', () => {
+ test('returns key-value map as plain object', () => {
const registry = new Registry();
registry.registerValue('a', 'cat');
registry.registerLoader('b', () => 'dog');
@@ -210,7 +210,7 @@ describe('Registry', () => {
});
describe('.getMapAsPromise()', () => {
- it('returns a promise of key-value map', () => {
+ test('returns a promise of key-value map', () => {
const registry = new Registry();
registry.registerValue('a', 'test1');
registry.registerLoader('b', () => 'test2');
@@ -227,7 +227,7 @@ describe('Registry', () => {
});
describe('.keys()', () => {
- it('returns an array of keys', () => {
+ test('returns an array of keys', () => {
const registry = new Registry();
registry.registerValue('a', 'testValue');
registry.registerLoader('b', () => 'test2');
@@ -236,7 +236,7 @@ describe('Registry', () => {
});
describe('.values()', () => {
- it('returns an array of values', () => {
+ test('returns an array of values', () => {
const registry = new Registry();
registry.registerValue('a', 'test1');
registry.registerLoader('b', () => 'test2');
@@ -245,7 +245,7 @@ describe('Registry', () => {
});
describe('.valuesAsPromise()', () => {
- it('returns a Promise of an array { key, value }', () => {
+ test('returns a Promise of an array { key, value }', () => {
const registry = new Registry();
registry.registerValue('a', 'test1');
registry.registerLoader('b', () => 'test2');
@@ -258,7 +258,7 @@ describe('Registry', () => {
});
describe('.entries()', () => {
- it('returns an array of { key, value }', () => {
+ test('returns an array of { key, value }', () => {
const registry = new Registry();
registry.registerValue('a', 'test1');
registry.registerLoader('b', () => 'test2');
@@ -270,7 +270,7 @@ describe('Registry', () => {
});
describe('.entriesAsPromise()', () => {
- it('returns a Promise of an array { key, value }', () => {
+ test('returns a Promise of an array { key, value }', () => {
const registry = new Registry();
registry.registerValue('a', 'test1');
registry.registerLoader('b', () => 'test2');
@@ -287,17 +287,17 @@ describe('Registry', () => {
});
describe('.remove(key)', () => {
- it('removes the item with given key', () => {
+ test('removes the item with given key', () => {
const registry = new Registry();
registry.registerValue('a', 'testValue');
registry.remove('a');
expect(registry.get('a')).toBeUndefined();
});
- it('does not throw error if the key does not exist', () => {
+ test('does not throw error if the key does not exist', () => {
const registry = new Registry();
expect(() => registry.remove('a')).not.toThrow();
});
- it('returns itself', () => {
+ test('returns itself', () => {
const registry = new Registry();
registry.registerValue('a', 'testValue');
expect(registry.remove('a')).toBe(registry);
@@ -307,7 +307,7 @@ describe('Registry', () => {
describe('config.overwritePolicy', () => {
describe('=ALLOW', () => {
describe('.registerValue(key, value)', () => {
- it('registers normally', () => {
+ test('registers normally', () => {
const restoreConsole = mockConsole();
const registry = new Registry();
registry.registerValue('a', 'testValue');
@@ -318,7 +318,7 @@ describe('Registry', () => {
});
});
describe('.registerLoader(key, loader)', () => {
- it('registers normally', () => {
+ test('registers normally', () => {
const restoreConsole = mockConsole();
const registry = new Registry();
registry.registerLoader('a', () => 'testValue');
@@ -333,7 +333,7 @@ describe('Registry', () => {
});
describe('=WARN', () => {
describe('.registerValue(key, value)', () => {
- it('warns when overwrite', () => {
+ test('warns when overwrite', () => {
const restoreConsole = mockConsole();
const registry = new Registry({
overwritePolicy: OverwritePolicy.Warn,
@@ -346,7 +346,7 @@ describe('Registry', () => {
});
});
describe('.registerLoader(key, loader)', () => {
- it('warns when overwrite', () => {
+ test('warns when overwrite', () => {
const restoreConsole = mockConsole();
const registry = new Registry({
overwritePolicy: OverwritePolicy.Warn,
@@ -363,7 +363,7 @@ describe('Registry', () => {
});
describe('=PROHIBIT', () => {
describe('.registerValue(key, value)', () => {
- it('throws error when overwrite', () => {
+ test('throws error when overwrite', () => {
const registry = new Registry({
overwritePolicy: OverwritePolicy.Prohibit,
});
@@ -372,7 +372,7 @@ describe('Registry', () => {
});
});
describe('.registerLoader(key, loader)', () => {
- it('warns when overwrite', () => {
+ test('warns when overwrite', () => {
const registry = new Registry({
overwritePolicy: OverwritePolicy.Prohibit,
});
@@ -394,36 +394,36 @@ describe('Registry', () => {
registry.addListener(listener);
});
- it('calls the listener when a value is registered', () => {
+ test('calls the listener when a value is registered', () => {
registry.registerValue('foo', 'bar');
expect(listener).toHaveBeenCalledWith(['foo']);
});
- it('calls the listener when a loader is registered', () => {
+ test('calls the listener when a loader is registered', () => {
registry.registerLoader('foo', () => 'bar');
expect(listener).toHaveBeenCalledWith(['foo']);
});
- it('calls the listener when a value is overridden', () => {
+ test('calls the listener when a value is overridden', () => {
registry.registerValue('foo', 'bar');
listener.mockClear();
registry.registerValue('foo', 'baz');
expect(listener).toHaveBeenCalledWith(['foo']);
});
- it('calls the listener when a value is removed', () => {
+ test('calls the listener when a value is removed', () => {
registry.registerValue('foo', 'bar');
listener.mockClear();
registry.remove('foo');
expect(listener).toHaveBeenCalledWith(['foo']);
});
- it('does not call the listener when a value is not actually removed', () => {
+ test('does not call the listener when a value is not actually removed', () => {
registry.remove('foo');
expect(listener).not.toHaveBeenCalled();
});
- it('calls the listener when registry is cleared', () => {
+ test('calls the listener when registry is cleared', () => {
registry.registerValue('foo', 'bar');
registry.registerLoader('fluz', () => 'baz');
listener.mockClear();
@@ -431,7 +431,7 @@ describe('Registry', () => {
expect(listener).toHaveBeenCalledWith(['foo', 'fluz']);
});
- it('removes listeners correctly', () => {
+ test('removes listeners correctly', () => {
registry.removeListener(listener);
registry.registerValue('foo', 'bar');
expect(listener).not.toHaveBeenCalled();
@@ -446,7 +446,7 @@ describe('Registry', () => {
restoreConsole();
});
- it('keeps working', () => {
+ test('keeps working', () => {
const errorListener = jest.fn().mockImplementation(() => {
throw new Error('test error');
});
diff --git a/superset-frontend/packages/superset-ui-core/test/models/RegistryWithDefaultKey.test.ts b/superset-frontend/packages/superset-ui-core/test/models/RegistryWithDefaultKey.test.ts
index 781d2c0aebd..208a7086523 100644
--- a/superset-frontend/packages/superset-ui-core/test/models/RegistryWithDefaultKey.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/models/RegistryWithDefaultKey.test.ts
@@ -26,23 +26,23 @@ describe('RegistryWithDefaultKey', () => {
registry = new RegistryWithDefaultKey();
});
- it('exists', () => {
+ test('exists', () => {
expect(RegistryWithDefaultKey).toBeDefined();
});
describe('new RegistryWithDefaultKey(config)', () => {
- it('returns a class that extends from Registry', () => {
+ test('returns a class that extends from Registry', () => {
expect(registry).toBeInstanceOf(Registry);
});
});
describe('.clear()', () => {
- it('also resets default key', () => {
+ test('also resets default key', () => {
registry.setDefaultKey('abc');
registry.clear();
expect(registry.getDefaultKey()).toBeUndefined();
});
- it('returns itself', () => {
+ test('returns itself', () => {
expect(registry.clear()).toBe(registry);
});
});
@@ -54,51 +54,51 @@ describe('RegistryWithDefaultKey', () => {
.registerValue('def', 200)
.setDefaultKey('abc');
});
- it('.get() returns value from default key', () => {
+ test('.get() returns value from default key', () => {
expect(registry.get()).toEqual(100);
});
- it('.get(key) returns value from specified key', () => {
+ test('.get(key) returns value from specified key', () => {
expect(registry.get('def')).toEqual(200);
});
- it('returns undefined if no key was given and there is no default key', () => {
+ test('returns undefined if no key was given and there is no default key', () => {
registry.clearDefaultKey();
expect(registry.get()).toBeUndefined();
});
});
describe('.getDefaultKey()', () => {
- it('returns defaultKey', () => {
+ test('returns defaultKey', () => {
registry.setDefaultKey('abc');
expect(registry.getDefaultKey()).toEqual('abc');
});
});
describe('.setDefaultKey(key)', () => {
- it('set the default key', () => {
+ test('set the default key', () => {
registry.setDefaultKey('abc');
expect(registry.defaultKey).toEqual('abc');
});
- it('returns itself', () => {
+ test('returns itself', () => {
expect(registry.setDefaultKey('ghi')).toBe(registry);
});
});
describe('.clearDefaultKey()', () => {
- it('set the default key to undefined', () => {
+ test('set the default key to undefined', () => {
registry.clearDefaultKey();
expect(registry.defaultKey).toBeUndefined();
});
- it('returns itself', () => {
+ test('returns itself', () => {
expect(registry.clearDefaultKey()).toBe(registry);
});
});
describe('config.defaultKey', () => {
describe('when not set', () => {
- it(`After creation, default key is undefined`, () => {
+ test(`After creation, default key is undefined`, () => {
expect(registry.defaultKey).toBeUndefined();
});
- it('.clear() reset defaultKey to undefined', () => {
+ test('.clear() reset defaultKey to undefined', () => {
registry.setDefaultKey('abc');
registry.clear();
expect(registry.getDefaultKey()).toBeUndefined();
@@ -108,10 +108,10 @@ describe('RegistryWithDefaultKey', () => {
const registry2 = new RegistryWithDefaultKey({
initialDefaultKey: 'def',
});
- it(`After creation, default key is undefined`, () => {
+ test(`After creation, default key is undefined`, () => {
expect(registry2.defaultKey).toEqual('def');
});
- it('.clear() reset defaultKey to this config.defaultKey', () => {
+ test('.clear() reset defaultKey to this config.defaultKey', () => {
registry2.setDefaultKey('abc');
registry2.clear();
expect(registry2.getDefaultKey()).toEqual('def');
@@ -128,28 +128,28 @@ describe('RegistryWithDefaultKey', () => {
registry2.clear();
});
describe('.registerValue(key, value)', () => {
- it('sets the default key to this key if default key is not set', () => {
+ test('sets the default key to this key if default key is not set', () => {
registry2.registerValue('abc', 100);
expect(registry2.getDefaultKey()).toEqual('abc');
});
- it('does not modify the default key if already set', () => {
+ test('does not modify the default key if already set', () => {
registry2.setDefaultKey('def').registerValue('abc', 100);
expect(registry2.getDefaultKey()).toEqual('def');
});
- it('returns itself', () => {
+ test('returns itself', () => {
expect(registry2.registerValue('ghi', 300)).toBe(registry2);
});
});
describe('.registerLoader(key, loader)', () => {
- it('sets the default key to this key if default key is not set', () => {
+ test('sets the default key to this key if default key is not set', () => {
registry2.registerLoader('abc', () => 100);
expect(registry2.getDefaultKey()).toEqual('abc');
});
- it('does not modify the default key if already set', () => {
+ test('does not modify the default key if already set', () => {
registry2.setDefaultKey('def').registerLoader('abc', () => 100);
expect(registry2.getDefaultKey()).toEqual('def');
});
- it('returns itself', () => {
+ test('returns itself', () => {
expect(registry2.registerLoader('ghi', () => 300)).toBe(registry2);
});
});
@@ -162,26 +162,26 @@ describe('RegistryWithDefaultKey', () => {
registry2.clear();
});
describe('.registerValue(key, value)', () => {
- it('does not modify default key', () => {
+ test('does not modify default key', () => {
registry2.registerValue('abc', 100);
expect(registry2.defaultKey).toBeUndefined();
registry2.setDefaultKey('def');
registry2.registerValue('ghi', 300);
expect(registry2.defaultKey).toEqual('def');
});
- it('returns itself', () => {
+ test('returns itself', () => {
expect(registry2.registerValue('ghi', 300)).toBe(registry2);
});
});
describe('.registerLoader(key, loader)', () => {
- it('does not modify default key', () => {
+ test('does not modify default key', () => {
registry2.registerValue('abc', () => 100);
expect(registry2.defaultKey).toBeUndefined();
registry2.setDefaultKey('def');
registry2.registerValue('ghi', () => 300);
expect(registry2.defaultKey).toEqual('def');
});
- it('returns itself', () => {
+ test('returns itself', () => {
expect(registry2.registerLoader('ghi', () => 300)).toBe(registry2);
});
});
diff --git a/superset-frontend/packages/superset-ui-core/test/models/TypedRegistry.test.ts b/superset-frontend/packages/superset-ui-core/test/models/TypedRegistry.test.ts
index 7eb0d88f9d7..693aea87418 100644
--- a/superset-frontend/packages/superset-ui-core/test/models/TypedRegistry.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/models/TypedRegistry.test.ts
@@ -20,12 +20,12 @@
import { TypedRegistry } from '@superset-ui/core';
describe('TypedRegistry', () => {
- it('gets a value', () => {
+ test('gets a value', () => {
const reg = new TypedRegistry({ foo: 'bar' });
expect(reg.get('foo')).toBe('bar');
});
- it('sets a value', () => {
+ test('sets a value', () => {
const reg = new TypedRegistry({ foo: 'bar' });
reg.set('foo', 'blah');
expect(reg.get('foo')).toBe('blah');
diff --git a/superset-frontend/packages/superset-ui-core/test/number-format/NumberFormatter.test.ts b/superset-frontend/packages/superset-ui-core/test/number-format/NumberFormatter.test.ts
index e8bee2dcffd..18b13708516 100644
--- a/superset-frontend/packages/superset-ui-core/test/number-format/NumberFormatter.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/number-format/NumberFormatter.test.ts
@@ -21,7 +21,7 @@ import { NumberFormatter } from '@superset-ui/core';
describe('NumberFormatter', () => {
describe('new NumberFormatter(config)', () => {
- it('requires config.id', () => {
+ test('requires config.id', () => {
expect(
() =>
// @ts-expect-error
@@ -30,7 +30,7 @@ describe('NumberFormatter', () => {
}),
).toThrow();
});
- it('requires config.formatFunc', () => {
+ test('requires config.formatFunc', () => {
expect(
() =>
// @ts-expect-error
@@ -45,10 +45,10 @@ describe('NumberFormatter', () => {
id: 'fixed_3',
formatFunc: value => value.toFixed(3),
});
- it('returns formatted value', () => {
+ test('returns formatted value', () => {
expect(formatter(12345.67)).toEqual('12345.670');
});
- it('formatter(value) is the same with formatter.format(value)', () => {
+ test('formatter(value) is the same with formatter.format(value)', () => {
const value = 12345.67;
expect(formatter(value)).toEqual(formatter.format(value));
});
@@ -58,20 +58,20 @@ describe('NumberFormatter', () => {
id: 'fixed_3',
formatFunc: value => value.toFixed(3),
});
- it('handles null', () => {
+ test('handles null', () => {
expect(formatter.format(null)).toEqual('null');
});
- it('handles undefined', () => {
+ test('handles undefined', () => {
expect(formatter.format(undefined)).toEqual('undefined');
});
- it('handles NaN', () => {
+ test('handles NaN', () => {
expect(formatter.format(NaN)).toEqual('NaN');
});
- it('handles positive and negative infinity', () => {
+ test('handles positive and negative infinity', () => {
expect(formatter.format(Number.POSITIVE_INFINITY)).toEqual('∞');
expect(formatter.format(Number.NEGATIVE_INFINITY)).toEqual('-∞');
});
- it('otherwise returns formatted value', () => {
+ test('otherwise returns formatted value', () => {
expect(formatter.format(12345.67)).toEqual('12345.670');
});
});
@@ -80,10 +80,10 @@ describe('NumberFormatter', () => {
id: 'fixed_2',
formatFunc: value => value.toFixed(2),
});
- it('returns string comparing value before and after formatting', () => {
+ test('returns string comparing value before and after formatting', () => {
expect(formatter.preview(100)).toEqual('100 => 100.00');
});
- it('uses the default preview value if not specified', () => {
+ test('uses the default preview value if not specified', () => {
expect(formatter.preview()).toEqual('12345.432 => 12345.43');
});
});
diff --git a/superset-frontend/packages/superset-ui-core/test/number-format/NumberFormatterRegistry.test.ts b/superset-frontend/packages/superset-ui-core/test/number-format/NumberFormatterRegistry.test.ts
index d2b1521f903..777d704158f 100644
--- a/superset-frontend/packages/superset-ui-core/test/number-format/NumberFormatterRegistry.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/number-format/NumberFormatterRegistry.test.ts
@@ -28,42 +28,42 @@ describe('NumberFormatterRegistry', () => {
beforeEach(() => {
registry = new NumberFormatterRegistry();
});
- it('has SMART_NUMBER as default formatter out of the box', () => {
+ test('has SMART_NUMBER as default formatter out of the box', () => {
expect(registry.getDefaultKey()).toBe(NumberFormats.SMART_NUMBER);
});
describe('.get(format)', () => {
- it('creates and returns a new formatter if does not exist', () => {
+ test('creates and returns a new formatter if does not exist', () => {
const formatter = registry.get('.2f');
expect(formatter).toBeInstanceOf(NumberFormatter);
expect(formatter.format(100)).toEqual('100.00');
});
- it('returns an existing formatter if already exists', () => {
+ test('returns an existing formatter if already exists', () => {
const formatter = registry.get('.2f');
const formatter2 = registry.get('.2f');
expect(formatter).toBe(formatter2);
});
- it('falls back to default format if format is not specified', () => {
+ test('falls back to default format if format is not specified', () => {
registry.setDefaultKey('.1f');
const formatter = registry.get();
expect(formatter.format(100)).toEqual('100.0');
});
- it('falls back to default format if format is null', () => {
+ test('falls back to default format if format is null', () => {
registry.setDefaultKey('.1f');
// @ts-expect-error
const formatter = registry.get(null);
expect(formatter.format(100)).toEqual('100.0');
});
- it('falls back to default format if format is undefined', () => {
+ test('falls back to default format if format is undefined', () => {
registry.setDefaultKey('.1f');
const formatter = registry.get(undefined);
expect(formatter.format(100)).toEqual('100.0');
});
- it('falls back to default format if format is empty string', () => {
+ test('falls back to default format if format is empty string', () => {
registry.setDefaultKey('.1f');
const formatter = registry.get('');
expect(formatter.format(100)).toEqual('100.0');
});
- it('removes leading and trailing spaces from format', () => {
+ test('removes leading and trailing spaces from format', () => {
const formatter = registry.get(' .2f');
expect(formatter).toBeInstanceOf(NumberFormatter);
expect(formatter.format(100)).toEqual('100.00');
@@ -76,11 +76,11 @@ describe('NumberFormatterRegistry', () => {
});
});
describe('.format(format, value)', () => {
- it('return the value with the specified format', () => {
+ test('return the value with the specified format', () => {
expect(registry.format('.2f', 100)).toEqual('100.00');
expect(registry.format(',d', 100)).toEqual('100');
});
- it('falls back to the default formatter if the format is undefined', () => {
+ test('falls back to the default formatter if the format is undefined', () => {
expect(registry.format(undefined, 1000)).toEqual('1k');
});
});
diff --git a/superset-frontend/packages/superset-ui-core/test/number-format/NumberFormatterRegistrySingleton.test.ts b/superset-frontend/packages/superset-ui-core/test/number-format/NumberFormatterRegistrySingleton.test.ts
index 9b653ba70e0..eb3130982e5 100644
--- a/superset-frontend/packages/superset-ui-core/test/number-format/NumberFormatterRegistrySingleton.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/number-format/NumberFormatterRegistrySingleton.test.ts
@@ -27,37 +27,37 @@ import {
describe('NumberFormatterRegistrySingleton', () => {
describe('getNumberFormatterRegistry()', () => {
- it('returns a NumberFormatterRegistry', () => {
+ test('returns a NumberFormatterRegistry', () => {
expect(getNumberFormatterRegistry()).toBeInstanceOf(
NumberFormatterRegistry,
);
});
});
describe('getNumberFormatter(format)', () => {
- it('returns a format function', () => {
+ test('returns a format function', () => {
const format = getNumberFormatter('.3s');
expect(format(12345)).toEqual('12.3k');
});
- it('returns a format function even given invalid format', () => {
+ test('returns a format function even given invalid format', () => {
const format = getNumberFormatter('xkcd');
expect(format(12345)).toEqual('12345 (Invalid format: xkcd)');
});
- it('falls back to default format if format is not specified', () => {
+ test('falls back to default format if format is not specified', () => {
const formatter = getNumberFormatter();
expect(formatter.format(100)).toEqual('100');
});
});
describe('formatNumber(format, value)', () => {
- it('format the given number using the specified format', () => {
+ test('format the given number using the specified format', () => {
const output = formatNumber('.3s', 12345);
expect(output).toEqual('12.3k');
});
- it('falls back to the default formatter if the format is undefined', () => {
+ test('falls back to the default formatter if the format is undefined', () => {
expect(formatNumber(undefined, 1000)).toEqual('1k');
});
});
describe('setD3Format()', () => {
- it('sets a specific FormatLocaleDefinition', () => {
+ test('sets a specific FormatLocaleDefinition', () => {
setD3Format({
decimal: ';',
thousands: '-',
@@ -67,7 +67,7 @@ describe('NumberFormatterRegistrySingleton', () => {
const formatter = getNumberFormatter('$,.2f');
expect(formatter.format(12345.67)).toEqual('€1-23-45;67');
});
- it('falls back to default value for unspecified locale format parameters', () => {
+ test('falls back to default value for unspecified locale format parameters', () => {
setD3Format({
currency: ['€', ''],
});
diff --git a/superset-frontend/packages/superset-ui-core/test/number-format/factories/createD3NumberFormatter.test.ts b/superset-frontend/packages/superset-ui-core/test/number-format/factories/createD3NumberFormatter.test.ts
index 677bdd403d7..348ece59fba 100644
--- a/superset-frontend/packages/superset-ui-core/test/number-format/factories/createD3NumberFormatter.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/number-format/factories/createD3NumberFormatter.test.ts
@@ -20,23 +20,23 @@
import { createD3NumberFormatter } from '@superset-ui/core';
describe('createD3NumberFormatter(config)', () => {
- it('requires config.formatString', () => {
+ test('requires config.formatString', () => {
// @ts-expect-error -- intentionally pass invalid input
expect(() => createD3NumberFormatter({})).toThrow();
});
describe('config.formatString', () => {
- it('creates a NumberFormatter with the formatString as id', () => {
+ test('creates a NumberFormatter with the formatString as id', () => {
const formatter = createD3NumberFormatter({ formatString: '.2f' });
expect(formatter.id).toEqual('.2f');
});
describe('if it is valid d3 formatString', () => {
- it('uses d3.format(config.formatString) as format function', () => {
+ test('uses d3.format(config.formatString) as format function', () => {
const formatter = createD3NumberFormatter({ formatString: '.2f' });
expect(formatter.format(100)).toEqual('100.00');
});
});
describe('if it is invalid d3 formatString', () => {
- it('The format function displays error message', () => {
+ test('The format function displays error message', () => {
const formatter = createD3NumberFormatter({
formatString: 'i-am-groot',
});
@@ -44,7 +44,7 @@ describe('createD3NumberFormatter(config)', () => {
'12345.67 (Invalid format: i-am-groot)',
);
});
- it('also set formatter.isInvalid to true', () => {
+ test('also set formatter.isInvalid to true', () => {
const formatter = createD3NumberFormatter({
formatString: 'i-am-groot',
});
@@ -53,7 +53,7 @@ describe('createD3NumberFormatter(config)', () => {
});
});
describe('config.label', () => {
- it('set label if specified', () => {
+ test('set label if specified', () => {
const formatter = createD3NumberFormatter({
formatString: '.2f',
label: 'float formatter',
@@ -62,7 +62,7 @@ describe('createD3NumberFormatter(config)', () => {
});
});
describe('config.description', () => {
- it('set description if specified', () => {
+ test('set description if specified', () => {
const formatter = createD3NumberFormatter({
description: 'lorem ipsum',
formatString: '.2f',
@@ -71,7 +71,7 @@ describe('createD3NumberFormatter(config)', () => {
});
});
describe('config.locale', () => {
- it('supports locale customization such as currency', () => {
+ test('supports locale customization such as currency', () => {
const formatter = createD3NumberFormatter({
description: 'lorem ipsum',
formatString: '$.2f',
@@ -86,7 +86,7 @@ describe('createD3NumberFormatter(config)', () => {
});
});
describe('negative numbers', () => {
- it('uses ASCII hyphen-minus (U+002D) for negative numbers, not Unicode minus (U+2212)', () => {
+ test('uses ASCII hyphen-minus (U+002D) for negative numbers, not Unicode minus (U+2212)', () => {
const formatter = createD3NumberFormatter({ formatString: ',d' });
const result = formatter(-1234);
// Verify the result contains ASCII hyphen-minus (char code 45), not Unicode minus (char code 8722)
@@ -94,7 +94,7 @@ describe('createD3NumberFormatter(config)', () => {
expect(result).toEqual('-1,234');
expect(result.charCodeAt(0)).toEqual(45); // ASCII hyphen-minus
});
- it('formats negative decimals correctly', () => {
+ test('formats negative decimals correctly', () => {
const formatter = createD3NumberFormatter({ formatString: ',.2f' });
expect(formatter(-1234.5)).toEqual('-1,234.50');
});
diff --git a/superset-frontend/packages/superset-ui-core/test/number-format/factories/createSiAtMostNDigitFormatter.test.ts b/superset-frontend/packages/superset-ui-core/test/number-format/factories/createSiAtMostNDigitFormatter.test.ts
index 30d6b3a6b16..c1e379bb2d7 100644
--- a/superset-frontend/packages/superset-ui-core/test/number-format/factories/createSiAtMostNDigitFormatter.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/number-format/factories/createSiAtMostNDigitFormatter.test.ts
@@ -23,17 +23,17 @@ import {
} from '@superset-ui/core';
describe('createSiAtMostNDigitFormatter({ n })', () => {
- it('creates an instance of NumberFormatter', () => {
+ test('creates an instance of NumberFormatter', () => {
const formatter = createSiAtMostNDigitFormatter({ n: 4 });
expect(formatter).toBeInstanceOf(NumberFormatter);
});
- it('uses ASCII hyphen-minus (U+002D) for negative numbers, not Unicode minus (U+2212)', () => {
+ test('uses ASCII hyphen-minus (U+002D) for negative numbers, not Unicode minus (U+2212)', () => {
// This is important for backward compatibility after d3-format v3 upgrade
const formatter = createSiAtMostNDigitFormatter({ n: 3 });
const result = formatter(-1000);
expect(result.charCodeAt(0)).toBe(45); // ASCII hyphen-minus
});
- it('when n is specified, it formats number in SI format with at most n significant digits', () => {
+ test('when n is specified, it formats number in SI format with at most n significant digits', () => {
const formatter = createSiAtMostNDigitFormatter({ n: 2 });
expect(formatter(10)).toBe('10');
expect(formatter(1)).toBe('1');
@@ -53,7 +53,7 @@ describe('createSiAtMostNDigitFormatter({ n })', () => {
expect(formatter(-111000000)).toBe('-110M');
expect(formatter(-0.23)).toBe('-230m');
});
- it('when n is not specified, it defaults to n=3', () => {
+ test('when n is not specified, it defaults to n=3', () => {
const formatter = createSiAtMostNDigitFormatter();
expect(formatter(10)).toBe('10');
expect(formatter(1)).toBe('1');
diff --git a/superset-frontend/packages/superset-ui-core/test/number-format/factories/createSmartNumberFormatter.test.ts b/superset-frontend/packages/superset-ui-core/test/number-format/factories/createSmartNumberFormatter.test.ts
index 427b096302a..77c91defcd9 100644
--- a/superset-frontend/packages/superset-ui-core/test/number-format/factories/createSmartNumberFormatter.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/number-format/factories/createSmartNumberFormatter.test.ts
@@ -20,27 +20,27 @@
import { NumberFormatter, createSmartNumberFormatter } from '@superset-ui/core';
describe('createSmartNumberFormatter(options)', () => {
- it('creates an instance of NumberFormatter', () => {
+ test('creates an instance of NumberFormatter', () => {
const formatter = createSmartNumberFormatter();
expect(formatter).toBeInstanceOf(NumberFormatter);
});
describe('using default options', () => {
const formatter = createSmartNumberFormatter();
- it('formats 0 correctly', () => {
+ test('formats 0 correctly', () => {
expect(formatter(0)).toBe('0');
});
describe('for positive numbers', () => {
- it('formats billion with B in stead of G', () => {
+ test('formats billion with B in stead of G', () => {
expect(formatter(1000000000)).toBe('1B');
expect(formatter(4560000000)).toBe('4.56B');
});
- it('formats numbers that are >= 1,000 & <= 1,000,000,000 as SI format with precision 3', () => {
+ test('formats numbers that are >= 1,000 & <= 1,000,000,000 as SI format with precision 3', () => {
expect(formatter(1000)).toBe('1k');
expect(formatter(10001)).toBe('10k');
expect(formatter(10100)).toBe('10.1k');
expect(formatter(111000000)).toBe('111M');
});
- it('formats number that are >= 1 & < 1,000 as integer or float with at most 2 decimal points', () => {
+ test('formats number that are >= 1 & < 1,000 as integer or float with at most 2 decimal points', () => {
expect(formatter(1)).toBe('1');
expect(formatter(1)).toBe('1');
expect(formatter(10)).toBe('10');
@@ -49,39 +49,39 @@ describe('createSmartNumberFormatter(options)', () => {
expect(formatter(274.2856)).toBe('274.29');
expect(formatter(999)).toBe('999');
});
- it('formats numbers that are < 1 & >= 0.001 as float with at most 4 decimal points', () => {
+ test('formats numbers that are < 1 & >= 0.001 as float with at most 4 decimal points', () => {
expect(formatter(0.1)).toBe('0.1');
expect(formatter(0.23)).toBe('0.23');
expect(formatter(0.699)).toBe('0.699');
expect(formatter(0.0023)).toBe('0.0023');
expect(formatter(0.002300001)).toBe('0.0023');
});
- it('formats numbers that are < 0.001 & >= 0.000001 as micron', () => {
+ test('formats numbers that are < 0.001 & >= 0.000001 as micron', () => {
expect(formatter(0.0002300001)).toBe('230µ');
expect(formatter(0.000023)).toBe('23µ');
expect(formatter(0.000001)).toBe('1µ');
});
- it('formats numbers that are less than 0.000001 as SI format with precision 3', () => {
+ test('formats numbers that are less than 0.000001 as SI format with precision 3', () => {
expect(formatter(0.0000001)).toBe('100n');
});
});
describe('for negative numbers', () => {
- it('uses ASCII hyphen-minus (U+002D), not Unicode minus (U+2212)', () => {
+ test('uses ASCII hyphen-minus (U+002D), not Unicode minus (U+2212)', () => {
// This is important for backward compatibility after d3-format v3 upgrade
const result = formatter(-1000);
expect(result.charCodeAt(0)).toBe(45); // ASCII hyphen-minus
});
- it('formats billion with B in stead of G', () => {
+ test('formats billion with B in stead of G', () => {
expect(formatter(-1000000000)).toBe('-1B');
expect(formatter(-4560000000)).toBe('-4.56B');
});
- it('formats numbers that are >= 1,000 & <= 1,000,000,000 as SI format with precision 3', () => {
+ test('formats numbers that are >= 1,000 & <= 1,000,000,000 as SI format with precision 3', () => {
expect(formatter(-1000)).toBe('-1k');
expect(formatter(-10001)).toBe('-10k');
expect(formatter(-10100)).toBe('-10.1k');
expect(formatter(-111000000)).toBe('-111M');
});
- it('formats number that are >= 1 & < 1,000 as integer or float with at most 2 decimal points', () => {
+ test('formats number that are >= 1 & < 1,000 as integer or float with at most 2 decimal points', () => {
expect(formatter(-1)).toBe('-1');
expect(formatter(-1)).toBe('-1');
expect(formatter(-10)).toBe('-10');
@@ -90,19 +90,19 @@ describe('createSmartNumberFormatter(options)', () => {
expect(formatter(-274.2856)).toBe('-274.29');
expect(formatter(-999)).toBe('-999');
});
- it('formats numbers that are < 1 & >= 0.001 as float with at most 4 decimal points', () => {
+ test('formats numbers that are < 1 & >= 0.001 as float with at most 4 decimal points', () => {
expect(formatter(-0.1)).toBe('-0.1');
expect(formatter(-0.23)).toBe('-0.23');
expect(formatter(-0.699)).toBe('-0.699');
expect(formatter(-0.0023)).toBe('-0.0023');
expect(formatter(-0.002300001)).toBe('-0.0023');
});
- it('formats numbers that are < 0.001 & >= 0.000001 as micron', () => {
+ test('formats numbers that are < 0.001 & >= 0.000001 as micron', () => {
expect(formatter(-0.0002300001)).toBe('-230µ');
expect(formatter(-0.000023)).toBe('-23µ');
expect(formatter(-0.000001)).toBe('-1µ');
});
- it('formats numbers that are less than 0.000001 as SI format with precision 3', () => {
+ test('formats numbers that are less than 0.000001 as SI format with precision 3', () => {
expect(formatter(-0.0000001)).toBe('-100n');
});
});
@@ -110,21 +110,21 @@ describe('createSmartNumberFormatter(options)', () => {
describe('when options.signed is true, it adds + for positive numbers', () => {
const formatter = createSmartNumberFormatter({ signed: true });
- it('formats 0 correctly', () => {
+ test('formats 0 correctly', () => {
expect(formatter(0)).toBe('0');
});
describe('for positive numbers', () => {
- it('formats billion with B in stead of G', () => {
+ test('formats billion with B in stead of G', () => {
expect(formatter(1000000000)).toBe('+1B');
expect(formatter(4560000000)).toBe('+4.56B');
});
- it('formats numbers that are >= 1,000 & <= 1,000,000,000 as SI format with precision 3', () => {
+ test('formats numbers that are >= 1,000 & <= 1,000,000,000 as SI format with precision 3', () => {
expect(formatter(1000)).toBe('+1k');
expect(formatter(10001)).toBe('+10k');
expect(formatter(10100)).toBe('+10.1k');
expect(formatter(111000000)).toBe('+111M');
});
- it('formats number that are >= 1 & < 1,000 as integer or float with at most 2 decimal points', () => {
+ test('formats number that are >= 1 & < 1,000 as integer or float with at most 2 decimal points', () => {
expect(formatter(1)).toBe('+1');
expect(formatter(1)).toBe('+1');
expect(formatter(10)).toBe('+10');
@@ -133,19 +133,19 @@ describe('createSmartNumberFormatter(options)', () => {
expect(formatter(274.2856)).toBe('+274.29');
expect(formatter(999)).toBe('+999');
});
- it('formats numbers that are < 1 & >= 0.001 as float with at most 4 decimal points', () => {
+ test('formats numbers that are < 1 & >= 0.001 as float with at most 4 decimal points', () => {
expect(formatter(0.1)).toBe('+0.1');
expect(formatter(0.23)).toBe('+0.23');
expect(formatter(0.699)).toBe('+0.699');
expect(formatter(0.0023)).toBe('+0.0023');
expect(formatter(0.002300001)).toBe('+0.0023');
});
- it('formats numbers that are < 0.001 & >= 0.000001 as micron', () => {
+ test('formats numbers that are < 0.001 & >= 0.000001 as micron', () => {
expect(formatter(0.0002300001)).toBe('+230µ');
expect(formatter(0.000023)).toBe('+23µ');
expect(formatter(0.000001)).toBe('+1µ');
});
- it('formats numbers that are less than 0.000001 as SI format with precision 3', () => {
+ test('formats numbers that are less than 0.000001 as SI format with precision 3', () => {
expect(formatter(0.0000001)).toBe('+100n');
});
});
diff --git a/superset-frontend/packages/superset-ui-core/test/number-format/index.test.ts b/superset-frontend/packages/superset-ui-core/test/number-format/index.test.ts
index 103f5e44a9b..48175cea0cb 100644
--- a/superset-frontend/packages/superset-ui-core/test/number-format/index.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/number-format/index.test.ts
@@ -31,7 +31,7 @@ import {
} from '@superset-ui/core';
describe('index', () => {
- it('exports modules', () => {
+ test('exports modules', () => {
[
createD3NumberFormatter,
createDurationFormatter,
diff --git a/superset-frontend/packages/superset-ui-core/test/query/DatasourceKey.test.ts b/superset-frontend/packages/superset-ui-core/test/query/DatasourceKey.test.ts
index 4a3c8772c37..0d6183f3dd4 100644
--- a/superset-frontend/packages/superset-ui-core/test/query/DatasourceKey.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/query/DatasourceKey.test.ts
@@ -19,13 +19,13 @@
import { DatasourceKey } from '@superset-ui/core';
describe('DatasourceKey', () => {
- it('should handle table data sources', () => {
+ test('should handle table data sources', () => {
const datasourceKey = new DatasourceKey('5__table');
expect(datasourceKey.toString()).toBe('5__table');
expect(datasourceKey.toObject()).toEqual({ id: 5, type: 'table' });
});
- it('should handle query data sources', () => {
+ test('should handle query data sources', () => {
const datasourceKey = new DatasourceKey('5__query');
expect(datasourceKey.toString()).toBe('5__query');
expect(datasourceKey.toObject()).toEqual({ id: 5, type: 'query' });
diff --git a/superset-frontend/packages/superset-ui-core/test/query/api/legacy/getDatasourceMetadata.test.ts b/superset-frontend/packages/superset-ui-core/test/query/api/legacy/getDatasourceMetadata.test.ts
index e5cc8a19beb..be94bfa9f68 100644
--- a/superset-frontend/packages/superset-ui-core/test/query/api/legacy/getDatasourceMetadata.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/query/api/legacy/getDatasourceMetadata.test.ts
@@ -29,7 +29,7 @@ describe('getFormData()', () => {
afterEach(() => fetchMock.clearHistory().removeRoutes());
- it('returns datasource metadata for given datasource key', () => {
+ test('returns datasource metadata for given datasource key', () => {
const mockData = {
field1: 'abc',
field2: 'def',
diff --git a/superset-frontend/packages/superset-ui-core/test/query/api/legacy/getFormData.test.ts b/superset-frontend/packages/superset-ui-core/test/query/api/legacy/getFormData.test.ts
index 7976e5e8870..ba43e977f37 100644
--- a/superset-frontend/packages/superset-ui-core/test/query/api/legacy/getFormData.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/query/api/legacy/getFormData.test.ts
@@ -44,7 +44,7 @@ describe('getFormData()', () => {
row_limit: 1000,
};
- it('returns formData for given slice id', () => {
+ test('returns formData for given slice id', () => {
fetchMock.get(`glob:*/api/v1/form_data/?slice_id=1`, mockData);
return expect(
@@ -54,7 +54,7 @@ describe('getFormData()', () => {
).resolves.toEqual(mockData);
});
- it('overrides formData when overrideFormData is specified', () => {
+ test('overrides formData when overrideFormData is specified', () => {
fetchMock.get(`glob:*/api/v1/form_data/?slice_id=1`, mockData);
return expect(
diff --git a/superset-frontend/packages/superset-ui-core/test/query/api/v1/getChartData.test.ts b/superset-frontend/packages/superset-ui-core/test/query/api/v1/getChartData.test.ts
index e2c4d61ac3c..28cfb747c96 100644
--- a/superset-frontend/packages/superset-ui-core/test/query/api/v1/getChartData.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/query/api/v1/getChartData.test.ts
@@ -28,7 +28,7 @@ describe('API v1 > getChartData()', () => {
afterEach(() => fetchMock.clearHistory().removeRoutes());
- it('returns a promise of ChartDataResponse', async () => {
+ test('returns a promise of ChartDataResponse', async () => {
const response = {
result: [
{
diff --git a/superset-frontend/packages/superset-ui-core/test/query/api/v1/handleError.test.ts b/superset-frontend/packages/superset-ui-core/test/query/api/v1/handleError.test.ts
index bcb47044f97..16587635651 100644
--- a/superset-frontend/packages/superset-ui-core/test/query/api/v1/handleError.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/query/api/v1/handleError.test.ts
@@ -45,19 +45,19 @@ async function testHandleError(
}
describe('handleError()', () => {
- it('should throw error directly', async () => {
+ test('should throw error directly', async () => {
expect.assertions(3);
const input = new SupersetApiError({ message: 'timeout' });
const output = await testHandleError(input, 'timeout');
expect(input).toBe(output);
});
- it('should handle error string', async () => {
+ test('should handle error string', async () => {
expect.assertions(2);
await testHandleError('STOP', 'STOP');
});
- it('should handle HTTP error', async () => {
+ test('should handle HTTP error', async () => {
expect.assertions(2);
const mockResponse = new Response('Ha?', {
status: 404,
@@ -66,7 +66,7 @@ describe('handleError()', () => {
await testHandleError(mockResponse, '404 NOT FOUND');
});
- it('should handle HTTP error with status < 400', async () => {
+ test('should handle HTTP error with status < 400', async () => {
expect.assertions(2);
const mockResponse = new Response('Ha haha?', {
status: 302,
@@ -75,7 +75,7 @@ describe('handleError()', () => {
await testHandleError(mockResponse, '302 Found');
});
- it('should use message from HTTP error', async () => {
+ test('should use message from HTTP error', async () => {
expect.assertions(2);
const mockResponse = new Response('{ "message": "BAD BAD" }', {
status: 500,
@@ -84,7 +84,7 @@ describe('handleError()', () => {
await testHandleError(mockResponse, 'BAD BAD');
});
- it('should handle response of single error', async () => {
+ test('should handle response of single error', async () => {
expect.assertions(2);
const mockResponse = new Response(
'{ "error": "BAD BAD", "link": "https://superset.apache.org" }',
@@ -99,7 +99,7 @@ describe('handleError()', () => {
});
});
- it('should handle single error object', async () => {
+ test('should handle single error object', async () => {
expect.assertions(2);
const mockError = {
error: {
@@ -113,7 +113,7 @@ describe('handleError()', () => {
});
});
- it('should process multi errors in HTTP json', async () => {
+ test('should process multi errors in HTTP json', async () => {
expect.assertions(2);
const mockResponse = new Response(
'{ "errors": [{ "error_type": "NOT OK" }] }',
@@ -125,7 +125,7 @@ describe('handleError()', () => {
await testHandleError(mockResponse, 'NOT OK');
});
- it('should handle invalid multi errors', async () => {
+ test('should handle invalid multi errors', async () => {
expect.assertions(4);
const mockResponse1 = new Response('{ "errors": [] }', {
status: 403,
@@ -139,7 +139,7 @@ describe('handleError()', () => {
await testHandleError(mockResponse2, '400 Bad Request');
});
- it('should fallback to statusText', async () => {
+ test('should fallback to statusText', async () => {
expect.assertions(2);
const mockResponse = new Response('{ "failed": "random ramble" }', {
status: 403,
@@ -148,7 +148,7 @@ describe('handleError()', () => {
await testHandleError(mockResponse, '403 Access Denied');
});
- it('should handle regular JS error', async () => {
+ test('should handle regular JS error', async () => {
expect.assertions(4);
await testHandleError(new Error('What?'), 'What?');
const emptyError = new Error();
@@ -156,12 +156,12 @@ describe('handleError()', () => {
await testHandleError(emptyError, 'Unknown Error');
});
- it('should handle { error: ... }', async () => {
+ test('should handle { error: ... }', async () => {
expect.assertions(2);
await testHandleError({ error: 'Hmm' }, 'Hmm');
});
- it('should throw unknown error', async () => {
+ test('should throw unknown error', async () => {
expect.assertions(4);
await testHandleError(
Promise.resolve('Some random things') as never,
diff --git a/superset-frontend/packages/superset-ui-core/test/query/api/v1/makeApi.test.ts b/superset-frontend/packages/superset-ui-core/test/query/api/v1/makeApi.test.ts
index 027537b025c..519680c0a52 100644
--- a/superset-frontend/packages/superset-ui-core/test/query/api/v1/makeApi.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/query/api/v1/makeApi.test.ts
@@ -29,7 +29,7 @@ describe('makeApi()', () => {
afterEach(() => fetchMock.clearHistory().removeRoutes());
- it('should expose method and endpoint', () => {
+ test('should expose method and endpoint', () => {
const api = makeApi({
method: 'GET',
endpoint: '/test',
@@ -39,7 +39,7 @@ describe('makeApi()', () => {
expect(api.requestType).toEqual('search');
});
- it('should allow custom path', async () => {
+ test('should allow custom path', async () => {
expect.assertions(2);
const api = makeApi({
method: 'GET',
@@ -62,7 +62,7 @@ describe('makeApi()', () => {
expect(mockRequest).toHaveBeenCalledTimes(1);
});
- it('should obtain json response by default', async () => {
+ test('should obtain json response by default', async () => {
expect.assertions(1);
const api = makeApi({
method: 'GET',
@@ -72,7 +72,7 @@ describe('makeApi()', () => {
expect(await api({})).toEqual({ yes: 'ok' });
});
- it('should allow custom parseResponse', async () => {
+ test('should allow custom parseResponse', async () => {
expect.assertions(2);
const responseJson = { items: [1, 2, 3] };
fetchMock.post('glob:*/test', responseJson);
@@ -86,7 +86,7 @@ describe('makeApi()', () => {
expect(await api({})).toBe(6);
});
- it('should post FormData when requestType=form', async () => {
+ test('should post FormData when requestType=form', async () => {
expect.assertions(3);
const api = makeApi({
method: 'POST',
@@ -105,7 +105,7 @@ describe('makeApi()', () => {
expect(received.get('request')).toEqual(expected.get('request'));
});
- it('should use searchParams for method=GET (`requestType=search` implied)', async () => {
+ test('should use searchParams for method=GET (`requestType=search` implied)', async () => {
expect.assertions(1);
const api = makeApi({
method: 'GET',
@@ -118,7 +118,7 @@ describe('makeApi()', () => {
);
});
- it('should serialize rison for method=GET, requestType=rison', async () => {
+ test('should serialize rison for method=GET, requestType=rison', async () => {
expect.assertions(1);
const api = makeApi({
method: 'GET',
@@ -132,7 +132,7 @@ describe('makeApi()', () => {
);
});
- it('should use searchParams for method=POST, requestType=search', async () => {
+ test('should use searchParams for method=POST, requestType=search', async () => {
expect.assertions(1);
const api = makeApi({
method: 'POST',
@@ -146,7 +146,7 @@ describe('makeApi()', () => {
);
});
- it('should throw when requestType is invalid', () => {
+ test('should throw when requestType is invalid', () => {
expect(() => {
makeApi({
method: 'POST',
@@ -157,7 +157,7 @@ describe('makeApi()', () => {
}).toThrow('Invalid request payload type');
});
- it('should handle errors', async () => {
+ test('should handle errors', async () => {
expect.assertions(1);
const api = makeApi({
method: 'POST',
@@ -177,7 +177,7 @@ describe('makeApi()', () => {
}
});
- it('should handle error on 200 response', async () => {
+ test('should handle error on 200 response', async () => {
expect.assertions(1);
const api = makeApi({
method: 'POST',
@@ -196,7 +196,7 @@ describe('makeApi()', () => {
}
});
- it('should parse text response when responseType=text', async () => {
+ test('should parse text response when responseType=text', async () => {
expect.assertions(1);
const api = makeApi({
method: 'PUT',
@@ -210,7 +210,7 @@ describe('makeApi()', () => {
expect(result).toBe('ok?');
});
- it('should return raw response when responseType=raw', async () => {
+ test('should return raw response when responseType=raw', async () => {
expect.assertions(2);
const api = makeApi({
method: 'DELETE',
diff --git a/superset-frontend/packages/superset-ui-core/test/query/buildQueryContext.test.ts b/superset-frontend/packages/superset-ui-core/test/query/buildQueryContext.test.ts
index 8f20b03e74a..600c6d8605e 100644
--- a/superset-frontend/packages/superset-ui-core/test/query/buildQueryContext.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/query/buildQueryContext.test.ts
@@ -20,7 +20,7 @@ import { buildQueryContext, VizType } from '@superset-ui/core';
import * as queryModule from '../../src/query/normalizeTimeColumn';
describe('buildQueryContext', () => {
- it('should build datasource for table sources and apply defaults', () => {
+ test('should build datasource for table sources and apply defaults', () => {
const queryContext = buildQueryContext({
datasource: '5__table',
granularity_sqla: 'ds',
@@ -32,7 +32,7 @@ describe('buildQueryContext', () => {
expect(queryContext.result_format).toBe('json');
expect(queryContext.result_type).toBe('full');
});
- it('should build datasource for table sources with columns', () => {
+ test('should build datasource for table sources with columns', () => {
const queryContext = buildQueryContext(
{
datasource: '5__table',
@@ -70,7 +70,7 @@ describe('buildQueryContext', () => {
]),
);
});
- it('should build datasource for table sources and process with custom function', () => {
+ test('should build datasource for table sources and process with custom function', () => {
const queryContext = buildQueryContext(
{
datasource: '5__table',
@@ -99,7 +99,7 @@ describe('buildQueryContext', () => {
);
});
// todo(Yongjie): move these test case into buildQueryObject.test.ts
- it('should remove undefined value in post_processing', () => {
+ test('should remove undefined value in post_processing', () => {
const queryContext = buildQueryContext(
{
datasource: '5__table',
@@ -124,7 +124,7 @@ describe('buildQueryContext', () => {
},
]);
});
- it('should call normalizeTimeColumn if has x_axis', () => {
+ test('should call normalizeTimeColumn if has x_axis', () => {
const spyNormalizeTimeColumn = jest.spyOn(
queryModule,
'normalizeTimeColumn',
diff --git a/superset-frontend/packages/superset-ui-core/test/query/buildQueryObject.test.ts b/superset-frontend/packages/superset-ui-core/test/query/buildQueryObject.test.ts
index fa4858efcb8..2b81ddcda7a 100644
--- a/superset-frontend/packages/superset-ui-core/test/query/buildQueryObject.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/query/buildQueryObject.test.ts
@@ -31,7 +31,7 @@ import {
describe('buildQueryObject', () => {
let query: QueryObject;
- it('should build granularity for sqlalchemy datasources', () => {
+ test('should build granularity for sqlalchemy datasources', () => {
query = buildQueryObject({
datasource: '5__table',
granularity_sqla: 'ds',
@@ -40,7 +40,7 @@ describe('buildQueryObject', () => {
expect(query.granularity).toEqual('ds');
});
- it('should build metrics based on default queryFields', () => {
+ test('should build metrics based on default queryFields', () => {
query = buildQueryObject({
datasource: '5__table',
granularity_sqla: 'ds',
@@ -51,7 +51,7 @@ describe('buildQueryObject', () => {
expect(query.metrics).toEqual(['sum__num', 'avg__num']);
});
- it('should merge original and append filters', () => {
+ test('should merge original and append filters', () => {
query = buildQueryObject({
datasource: '5__table',
granularity_sqla: 'ds',
@@ -84,7 +84,7 @@ describe('buildQueryObject', () => {
expect(query.extras?.where).toEqual('(a = b) AND ((1 = 1))');
});
- it('should group custom metric control', () => {
+ test('should group custom metric control', () => {
query = buildQueryObject(
{
datasource: '5__table',
@@ -97,7 +97,7 @@ describe('buildQueryObject', () => {
expect(query.metrics).toEqual(['sum__num']);
});
- it('should group custom metric control with predefined metrics', () => {
+ test('should group custom metric control with predefined metrics', () => {
query = buildQueryObject(
{
datasource: '5__table',
@@ -111,7 +111,7 @@ describe('buildQueryObject', () => {
expect(query.metrics).toEqual(['sum__num', 'avg__num']);
});
- it('should build series_limit from legacy control', () => {
+ test('should build series_limit from legacy control', () => {
const series_limit = 2;
query = buildQueryObject({
datasource: '5__table',
@@ -122,7 +122,7 @@ describe('buildQueryObject', () => {
expect(query.series_limit).toEqual(series_limit);
});
- it('should build series_limit', () => {
+ test('should build series_limit', () => {
const series_limit = 2;
query = buildQueryObject({
datasource: '5__table',
@@ -133,7 +133,7 @@ describe('buildQueryObject', () => {
expect(query.series_limit).toEqual(series_limit);
});
- it('should build order_desc', () => {
+ test('should build order_desc', () => {
const orderDesc = false;
query = buildQueryObject({
datasource: '5__table',
@@ -144,7 +144,7 @@ describe('buildQueryObject', () => {
expect(query.order_desc).toEqual(orderDesc);
});
- it('should build series_limit_metric from legacy control', () => {
+ test('should build series_limit_metric from legacy control', () => {
const metric = 'country';
query = buildQueryObject({
datasource: '5__table',
@@ -155,7 +155,7 @@ describe('buildQueryObject', () => {
expect(query.series_limit_metric).toEqual(metric);
});
- it('should build series_limit_metric', () => {
+ test('should build series_limit_metric', () => {
const metric = 'country';
query = buildQueryObject({
datasource: '5__table',
@@ -166,7 +166,7 @@ describe('buildQueryObject', () => {
expect(query.series_limit_metric).toEqual(metric);
});
- it('should build series_limit_metric as undefined when empty array', () => {
+ test('should build series_limit_metric as undefined when empty array', () => {
const metric: any = [];
query = buildQueryObject({
datasource: '5__table',
@@ -177,7 +177,7 @@ describe('buildQueryObject', () => {
expect(query.series_limit_metric).toEqual(undefined);
});
- it('should handle null and non-numeric row_limit and row_offset', () => {
+ test('should handle null and non-numeric row_limit and row_offset', () => {
const baseQuery = {
datasource: '5__table',
granularity_sqla: 'ds',
@@ -222,7 +222,7 @@ describe('buildQueryObject', () => {
expect(query.row_offset).toBeUndefined();
});
- it('should populate annotation_layers', () => {
+ test('should populate annotation_layers', () => {
const annotationLayers: AnnotationLayer[] = [
{
annotationType: AnnotationType.Formula,
@@ -274,7 +274,7 @@ describe('buildQueryObject', () => {
expect(query.annotation_layers).toEqual(annotationLayers);
});
- it('should populate url_params', () => {
+ test('should populate url_params', () => {
expect(
buildQueryObject({
datasource: '5__table',
@@ -294,7 +294,7 @@ describe('buildQueryObject', () => {
).toBeUndefined();
});
- it('should populate granularity', () => {
+ test('should populate granularity', () => {
const granularity = 'ds';
query = buildQueryObject({
datasource: '5__table',
@@ -304,7 +304,7 @@ describe('buildQueryObject', () => {
expect(query.granularity).toEqual(granularity);
});
- it('should populate granularity from legacy field', () => {
+ test('should populate granularity from legacy field', () => {
const granularity = 'ds';
query = buildQueryObject({
datasource: '5__table',
@@ -314,7 +314,7 @@ describe('buildQueryObject', () => {
expect(query.granularity).toEqual(granularity);
});
- it('should populate custom_params', () => {
+ test('should populate custom_params', () => {
const customParams: JsonObject = {
customObject: { id: 137, name: 'C-137' },
};
diff --git a/superset-frontend/packages/superset-ui-core/test/query/convertFilter.test.ts b/superset-frontend/packages/superset-ui-core/test/query/convertFilter.test.ts
index 1a7e54b4008..4d97594b6b6 100644
--- a/superset-frontend/packages/superset-ui-core/test/query/convertFilter.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/query/convertFilter.test.ts
@@ -19,7 +19,7 @@
import { convertFilter } from '@superset-ui/core';
describe('convertFilter', () => {
- it('should handle unary filter', () => {
+ test('should handle unary filter', () => {
expect(
convertFilter({
expressionType: 'SIMPLE',
@@ -33,7 +33,7 @@ describe('convertFilter', () => {
});
});
- it('should convert binary filter', () => {
+ test('should convert binary filter', () => {
expect(
convertFilter({
expressionType: 'SIMPLE',
@@ -49,7 +49,7 @@ describe('convertFilter', () => {
});
});
- it('should convert set filter', () => {
+ test('should convert set filter', () => {
expect(
convertFilter({
expressionType: 'SIMPLE',
diff --git a/superset-frontend/packages/superset-ui-core/test/query/extractExtras.test.ts b/superset-frontend/packages/superset-ui-core/test/query/extractExtras.test.ts
index 35174f72bd3..c95e299e7e1 100644
--- a/superset-frontend/packages/superset-ui-core/test/query/extractExtras.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/query/extractExtras.test.ts
@@ -27,7 +27,7 @@ describe('extractExtras', () => {
viz_type: 'my_viz',
};
- it('should populate time range endpoints and override formData with double underscored date options', () => {
+ test('should populate time range endpoints and override formData with double underscored date options', () => {
expect(
extractExtras({
...baseQueryFormData,
@@ -64,7 +64,7 @@ describe('extractExtras', () => {
});
});
- it('should create regular filters from non-reserved columns', () => {
+ test('should create regular filters from non-reserved columns', () => {
expect(
extractExtras({
...baseQueryFormData,
@@ -102,7 +102,7 @@ describe('extractExtras', () => {
});
});
- it('should create regular filters from reserved and non-reserved columns', () => {
+ test('should create regular filters from reserved and non-reserved columns', () => {
expect(
extractExtras({
...baseQueryFormData,
diff --git a/superset-frontend/packages/superset-ui-core/test/query/extractQueryFields.test.ts b/superset-frontend/packages/superset-ui-core/test/query/extractQueryFields.test.ts
index b6e5257701b..38dd0c72e18 100644
--- a/superset-frontend/packages/superset-ui-core/test/query/extractQueryFields.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/query/extractQueryFields.test.ts
@@ -24,7 +24,7 @@ import { NUM_METRIC } from '../fixtures';
configure();
describe('extractQueryFields', () => {
- it('should return default object', () => {
+ test('should return default object', () => {
expect(extractQueryFields({})).toEqual({
columns: [],
metrics: [],
@@ -32,7 +32,7 @@ describe('extractQueryFields', () => {
});
});
- it('should group single value to arrays', () => {
+ test('should group single value to arrays', () => {
expect(
extractQueryFields({
metric: 'my_metric',
@@ -46,7 +46,7 @@ describe('extractQueryFields', () => {
});
});
- it('should combine field aliases', () => {
+ test('should combine field aliases', () => {
expect(
extractQueryFields(
{
@@ -59,7 +59,7 @@ describe('extractQueryFields', () => {
).toEqual(['metric_1', 'metric_2', 'my_custom_metric']);
});
- it('should extract columns', () => {
+ test('should extract columns', () => {
expect(extractQueryFields({ columns: 'col_1' })).toEqual({
columns: ['col_1'],
metrics: [],
@@ -67,7 +67,7 @@ describe('extractQueryFields', () => {
});
});
- it('should extract groupby as columns and set empty metrics', () => {
+ test('should extract groupby as columns and set empty metrics', () => {
expect(extractQueryFields({ groupby: 'col_1' })).toEqual({
columns: ['col_1'],
metrics: [],
@@ -75,7 +75,7 @@ describe('extractQueryFields', () => {
});
});
- it('should remove duplicate metrics', () => {
+ test('should remove duplicate metrics', () => {
expect(
extractQueryFields({
metrics: ['col_1', { ...NUM_METRIC }, { ...NUM_METRIC }],
@@ -87,7 +87,7 @@ describe('extractQueryFields', () => {
});
});
- it('should extract custom columns fields', () => {
+ test('should extract custom columns fields', () => {
expect(
extractQueryFields(
{ series: 'col_1', metric: 'metric_1' },
@@ -100,7 +100,7 @@ describe('extractQueryFields', () => {
});
});
- it('should merge custom groupby into columns', () => {
+ test('should merge custom groupby into columns', () => {
expect(
extractQueryFields(
{ groupby: 'col_1', series: 'col_2', metric: 'metric_1' },
@@ -113,13 +113,13 @@ describe('extractQueryFields', () => {
});
});
- it('should ignore null values', () => {
+ test('should ignore null values', () => {
expect(
extractQueryFields({ series: ['a'], columns: null }).columns,
).toEqual(['a']);
});
- it('should ignore groupby and metrics when in raw QueryMode', () => {
+ test('should ignore groupby and metrics when in raw QueryMode', () => {
expect(
extractQueryFields({
columns: ['a'],
@@ -134,7 +134,7 @@ describe('extractQueryFields', () => {
});
});
- it('should ignore columns when in aggregate QueryMode', () => {
+ test('should ignore columns when in aggregate QueryMode', () => {
expect(
extractQueryFields({
columns: ['a'],
@@ -161,7 +161,7 @@ describe('extractQueryFields', () => {
});
});
- it('should parse orderby if needed', () => {
+ test('should parse orderby if needed', () => {
expect(
extractQueryFields({
columns: ['a'],
@@ -179,7 +179,7 @@ describe('extractQueryFields', () => {
});
});
- it('should throw error if parse orderby failed', () => {
+ test('should throw error if parse orderby failed', () => {
expect(() => {
extractQueryFields({
orderby: ['ccc'],
diff --git a/superset-frontend/packages/superset-ui-core/test/query/extractTimegrain.test.ts b/superset-frontend/packages/superset-ui-core/test/query/extractTimegrain.test.ts
index 384b09cabaf..06facc98fec 100644
--- a/superset-frontend/packages/superset-ui-core/test/query/extractTimegrain.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/query/extractTimegrain.test.ts
@@ -23,7 +23,7 @@ describe('extractTimegrain', () => {
datasource: 'table__1',
viz_type: 'my_viz',
};
- it('should extract regular from form data', () => {
+ test('should extract regular from form data', () => {
expect(
extractTimegrain({
...baseFormData,
@@ -32,7 +32,7 @@ describe('extractTimegrain', () => {
).toEqual('P1D');
});
- it('should extract filter time grain from form data', () => {
+ test('should extract filter time grain from form data', () => {
expect(
extractTimegrain({
...baseFormData,
@@ -48,7 +48,7 @@ describe('extractTimegrain', () => {
).toEqual('P1M');
});
- it('should extract native filter time grain from form data', () => {
+ test('should extract native filter time grain from form data', () => {
expect(
extractTimegrain({
...baseFormData,
@@ -60,7 +60,7 @@ describe('extractTimegrain', () => {
).toEqual('P1W');
});
- it('should give priority to native filters', () => {
+ test('should give priority to native filters', () => {
expect(
extractTimegrain({
...baseFormData,
@@ -79,7 +79,7 @@ describe('extractTimegrain', () => {
).toEqual('P1W');
});
- it('returns undefined if timegrain not defined', () => {
+ test('returns undefined if timegrain not defined', () => {
expect(extractTimegrain({ ...baseFormData })).toEqual(undefined);
});
});
diff --git a/superset-frontend/packages/superset-ui-core/test/query/getColumnLabel.test.ts b/superset-frontend/packages/superset-ui-core/test/query/getColumnLabel.test.ts
index e0e65c43324..2aaeeaff3d5 100644
--- a/superset-frontend/packages/superset-ui-core/test/query/getColumnLabel.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/query/getColumnLabel.test.ts
@@ -19,11 +19,11 @@
import { getColumnLabel } from '@superset-ui/core';
describe('getColumnLabel', () => {
- it('should handle physical column', () => {
+ test('should handle physical column', () => {
expect(getColumnLabel('gender')).toEqual('gender');
});
- it('should handle adhoc columns with label', () => {
+ test('should handle adhoc columns with label', () => {
expect(
getColumnLabel({
sqlExpression: "case when 1 then 'a' else 'b' end",
@@ -33,7 +33,7 @@ describe('getColumnLabel', () => {
).toEqual('my col');
});
- it('should handle adhoc columns without label', () => {
+ test('should handle adhoc columns without label', () => {
expect(
getColumnLabel({
sqlExpression: "case when 1 then 'a' else 'b' end",
diff --git a/superset-frontend/packages/superset-ui-core/test/query/getMetricLabel.test.ts b/superset-frontend/packages/superset-ui-core/test/query/getMetricLabel.test.ts
index 057c3225ea9..5e51b4946f3 100644
--- a/superset-frontend/packages/superset-ui-core/test/query/getMetricLabel.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/query/getMetricLabel.test.ts
@@ -19,11 +19,11 @@
import { getMetricLabel } from '@superset-ui/core';
describe('getMetricLabel', () => {
- it('should handle predefined metric name', () => {
+ test('should handle predefined metric name', () => {
expect(getMetricLabel('sum__num')).toEqual('sum__num');
});
- it('should handle simple adhoc metrics', () => {
+ test('should handle simple adhoc metrics', () => {
expect(
getMetricLabel({
expressionType: 'SIMPLE',
@@ -37,7 +37,7 @@ describe('getMetricLabel', () => {
).toEqual('AVG(sum_girls)');
});
- it('should handle column_name in alternative field', () => {
+ test('should handle column_name in alternative field', () => {
expect(
getMetricLabel({
expressionType: 'SIMPLE',
@@ -51,7 +51,7 @@ describe('getMetricLabel', () => {
).toEqual('AVG(sum_girls)');
});
- it('should handle SQL adhoc metrics', () => {
+ test('should handle SQL adhoc metrics', () => {
expect(
getMetricLabel({
expressionType: 'SQL',
@@ -60,7 +60,7 @@ describe('getMetricLabel', () => {
).toEqual('COUNT(sum_girls)');
});
- it('should handle adhoc metrics with custom labels', () => {
+ test('should handle adhoc metrics with custom labels', () => {
expect(
getMetricLabel({
expressionType: 'SQL',
diff --git a/superset-frontend/packages/superset-ui-core/test/query/normalizeOrderBy.test.ts b/superset-frontend/packages/superset-ui-core/test/query/normalizeOrderBy.test.ts
index 0bc8da67e4f..82f1df783be 100644
--- a/superset-frontend/packages/superset-ui-core/test/query/normalizeOrderBy.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/query/normalizeOrderBy.test.ts
@@ -19,7 +19,7 @@
import { normalizeOrderBy, QueryObject, VizType } from '@superset-ui/core';
describe('normalizeOrderBy', () => {
- it('should not change original queryObject when orderby populated', () => {
+ test('should not change original queryObject when orderby populated', () => {
const query: QueryObject = {
datasource: '5__table',
viz_type: VizType.Table,
@@ -29,7 +29,7 @@ describe('normalizeOrderBy', () => {
expect(normalizeOrderBy(query)).toEqual(query);
});
- it('has series_limit_metric in queryObject', () => {
+ test('has series_limit_metric in queryObject', () => {
const query: QueryObject = {
datasource: '5__table',
viz_type: VizType.Table,
@@ -69,7 +69,7 @@ describe('normalizeOrderBy', () => {
});
});
- it('should transform legacy_order_by in queryObject', () => {
+ test('should transform legacy_order_by in queryObject', () => {
const query: QueryObject = {
datasource: '5__table',
viz_type: VizType.Table,
@@ -109,7 +109,7 @@ describe('normalizeOrderBy', () => {
});
});
- it('has metrics in queryObject', () => {
+ test('has metrics in queryObject', () => {
const query: QueryObject = {
datasource: '5__table',
viz_type: VizType.Table,
@@ -129,7 +129,7 @@ describe('normalizeOrderBy', () => {
});
});
- it('should not change', () => {
+ test('should not change', () => {
const query: QueryObject = {
datasource: '5__table',
viz_type: VizType.Table,
@@ -138,7 +138,7 @@ describe('normalizeOrderBy', () => {
expect(normalizeOrderBy(query)).toEqual(query);
});
- it('remove empty orderby', () => {
+ test('remove empty orderby', () => {
const query: QueryObject = {
datasource: '5__table',
viz_type: VizType.Table,
@@ -148,7 +148,7 @@ describe('normalizeOrderBy', () => {
expect(normalizeOrderBy(query)).not.toHaveProperty('orderby');
});
- it('remove orderby with an empty array', () => {
+ test('remove orderby with an empty array', () => {
const query: QueryObject = {
datasource: '5__table',
viz_type: VizType.Table,
@@ -158,7 +158,7 @@ describe('normalizeOrderBy', () => {
expect(normalizeOrderBy(query)).not.toHaveProperty('orderby');
});
- it('remove orderby with an empty metric', () => {
+ test('remove orderby with an empty metric', () => {
const query: QueryObject = {
datasource: '5__table',
viz_type: VizType.Table,
@@ -168,7 +168,7 @@ describe('normalizeOrderBy', () => {
expect(normalizeOrderBy(query)).not.toHaveProperty('orderby');
});
- it('remove orderby with an empty adhoc metric', () => {
+ test('remove orderby with an empty adhoc metric', () => {
const query: QueryObject = {
datasource: '5__table',
viz_type: VizType.Table,
@@ -178,7 +178,7 @@ describe('normalizeOrderBy', () => {
expect(normalizeOrderBy(query)).not.toHaveProperty('orderby');
});
- it('remove orderby with an non-boolean type', () => {
+ test('remove orderby with an non-boolean type', () => {
const query: QueryObject = {
datasource: '5__table',
viz_type: VizType.Table,
diff --git a/superset-frontend/packages/superset-ui-core/test/query/processExtraFormData.test.ts b/superset-frontend/packages/superset-ui-core/test/query/processExtraFormData.test.ts
index b688b03ca92..dd5dd56ebba 100644
--- a/superset-frontend/packages/superset-ui-core/test/query/processExtraFormData.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/query/processExtraFormData.test.ts
@@ -19,7 +19,7 @@
import { overrideExtraFormData } from '../../src/query/processExtraFormData';
describe('overrideExtraFormData', () => {
- it('should assign allowed nonexistent value', () => {
+ test('should assign allowed nonexistent value', () => {
expect(
overrideExtraFormData(
{
@@ -39,7 +39,7 @@ describe('overrideExtraFormData', () => {
});
});
- it('should override allowed preexisting value', () => {
+ test('should override allowed preexisting value', () => {
expect(
overrideExtraFormData(
{
@@ -60,7 +60,7 @@ describe('overrideExtraFormData', () => {
});
});
- it('should not override non-allowed value', () => {
+ test('should not override non-allowed value', () => {
expect(
overrideExtraFormData(
{
@@ -82,7 +82,7 @@ describe('overrideExtraFormData', () => {
});
});
- it('should override preexisting extra value', () => {
+ test('should override preexisting extra value', () => {
expect(
overrideExtraFormData(
{
@@ -107,7 +107,7 @@ describe('overrideExtraFormData', () => {
});
});
- it('should add extra override value', () => {
+ test('should add extra override value', () => {
expect(
overrideExtraFormData(
{
diff --git a/superset-frontend/packages/superset-ui-core/test/query/processFilters.test.ts b/superset-frontend/packages/superset-ui-core/test/query/processFilters.test.ts
index 0d4fc4cd9f7..c2d8fdb9436 100644
--- a/superset-frontend/packages/superset-ui-core/test/query/processFilters.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/query/processFilters.test.ts
@@ -19,7 +19,7 @@
import processFilters from '../../src/query/processFilters';
describe('processFilters', () => {
- it('should handle non-array adhoc_filters', () => {
+ test('should handle non-array adhoc_filters', () => {
expect(
processFilters({
granularity: 'something',
@@ -34,7 +34,7 @@ describe('processFilters', () => {
);
});
- it('should merge simple adhoc_filters and filters', () => {
+ test('should merge simple adhoc_filters and filters', () => {
expect(
processFilters({
granularity: 'something',
@@ -83,7 +83,7 @@ describe('processFilters', () => {
});
});
- it('should handle an empty array', () => {
+ test('should handle an empty array', () => {
expect(
processFilters({
where: '1 = 1',
@@ -101,7 +101,7 @@ describe('processFilters', () => {
});
});
- it('should put adhoc_filters into the correct group and format accordingly', () => {
+ test('should put adhoc_filters into the correct group and format accordingly', () => {
expect(
processFilters({
granularity: 'something',
diff --git a/superset-frontend/packages/superset-ui-core/test/query/types/AnnotationLayer.test.ts b/superset-frontend/packages/superset-ui-core/test/query/types/AnnotationLayer.test.ts
index a2752c5cbc3..2eb8da8a5d1 100644
--- a/superset-frontend/packages/superset-ui-core/test/query/types/AnnotationLayer.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/query/types/AnnotationLayer.test.ts
@@ -79,10 +79,10 @@ describe('AnnotationLayer type guards', () => {
showLabel: false,
};
describe('isFormulaAnnotationLayer', () => {
- it('should return true when it is the correct type', () => {
+ test('should return true when it is the correct type', () => {
expect(isFormulaAnnotationLayer(formulaAnnotationLayer)).toEqual(true);
});
- it('should return false otherwise', () => {
+ test('should return false otherwise', () => {
expect(isFormulaAnnotationLayer(eventAnnotationLayer)).toEqual(false);
expect(isFormulaAnnotationLayer(intervalAnnotationLayer)).toEqual(false);
expect(isFormulaAnnotationLayer(timeseriesAnnotationLayer)).toEqual(
@@ -92,10 +92,10 @@ describe('AnnotationLayer type guards', () => {
});
describe('isEventAnnotationLayer', () => {
- it('should return true when it is the correct type', () => {
+ test('should return true when it is the correct type', () => {
expect(isEventAnnotationLayer(eventAnnotationLayer)).toEqual(true);
});
- it('should return false otherwise', () => {
+ test('should return false otherwise', () => {
expect(isEventAnnotationLayer(formulaAnnotationLayer)).toEqual(false);
expect(isEventAnnotationLayer(intervalAnnotationLayer)).toEqual(false);
expect(isEventAnnotationLayer(timeseriesAnnotationLayer)).toEqual(false);
@@ -103,10 +103,10 @@ describe('AnnotationLayer type guards', () => {
});
describe('isIntervalAnnotationLayer', () => {
- it('should return true when it is the correct type', () => {
+ test('should return true when it is the correct type', () => {
expect(isIntervalAnnotationLayer(intervalAnnotationLayer)).toEqual(true);
});
- it('should return false otherwise', () => {
+ test('should return false otherwise', () => {
expect(isIntervalAnnotationLayer(formulaAnnotationLayer)).toEqual(false);
expect(isIntervalAnnotationLayer(eventAnnotationLayer)).toEqual(false);
expect(isIntervalAnnotationLayer(timeseriesAnnotationLayer)).toEqual(
@@ -116,12 +116,12 @@ describe('AnnotationLayer type guards', () => {
});
describe('isTimeseriesAnnotationLayer', () => {
- it('should return true when it is the correct type', () => {
+ test('should return true when it is the correct type', () => {
expect(isTimeseriesAnnotationLayer(timeseriesAnnotationLayer)).toEqual(
true,
);
});
- it('should return false otherwise', () => {
+ test('should return false otherwise', () => {
expect(isTimeseriesAnnotationLayer(formulaAnnotationLayer)).toEqual(
false,
);
@@ -133,10 +133,10 @@ describe('AnnotationLayer type guards', () => {
});
describe('isTableAnnotationLayer', () => {
- it('should return true when it is the correct type', () => {
+ test('should return true when it is the correct type', () => {
expect(isTableAnnotationLayer(tableAnnotationLayer)).toEqual(true);
});
- it('should return false otherwise', () => {
+ test('should return false otherwise', () => {
expect(isTableAnnotationLayer(formulaAnnotationLayer)).toEqual(false);
});
});
diff --git a/superset-frontend/packages/superset-ui-core/test/query/types/Filter.test.ts b/superset-frontend/packages/superset-ui-core/test/query/types/Filter.test.ts
index 4aa4a474159..5d64989a19b 100644
--- a/superset-frontend/packages/superset-ui-core/test/query/types/Filter.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/query/types/Filter.test.ts
@@ -26,7 +26,7 @@ import {
describe('Filter type guards', () => {
describe('isUnaryAdhocFilter', () => {
- it('should return true when it is the correct type', () => {
+ test('should return true when it is the correct type', () => {
expect(
isUnaryAdhocFilter({
expressionType: 'SIMPLE',
@@ -36,7 +36,7 @@ describe('Filter type guards', () => {
}),
).toEqual(true);
});
- it('should return false otherwise', () => {
+ test('should return false otherwise', () => {
expect(
isUnaryAdhocFilter({
expressionType: 'SIMPLE',
@@ -50,7 +50,7 @@ describe('Filter type guards', () => {
});
describe('isBinaryAdhocFilter', () => {
- it('should return true when it is the correct type', () => {
+ test('should return true when it is the correct type', () => {
expect(
isBinaryAdhocFilter({
expressionType: 'SIMPLE',
@@ -61,7 +61,7 @@ describe('Filter type guards', () => {
}),
).toEqual(true);
});
- it('should return false otherwise', () => {
+ test('should return false otherwise', () => {
expect(
isBinaryAdhocFilter({
expressionType: 'SIMPLE',
@@ -74,7 +74,7 @@ describe('Filter type guards', () => {
});
describe('isSetAdhocFilter', () => {
- it('should return true when it is the correct type', () => {
+ test('should return true when it is the correct type', () => {
expect(
isSetAdhocFilter({
expressionType: 'SIMPLE',
@@ -85,7 +85,7 @@ describe('Filter type guards', () => {
}),
).toEqual(true);
});
- it('should return false otherwise', () => {
+ test('should return false otherwise', () => {
expect(
isSetAdhocFilter({
expressionType: 'SIMPLE',
@@ -97,7 +97,7 @@ describe('Filter type guards', () => {
});
});
describe('isFreeFormAdhocFilter', () => {
- it('should return true when it is the correct type', () => {
+ test('should return true when it is the correct type', () => {
expect(
isFreeFormAdhocFilter({
expressionType: 'SQL',
@@ -106,7 +106,7 @@ describe('Filter type guards', () => {
}),
).toEqual(true);
});
- it('should return false otherwise', () => {
+ test('should return false otherwise', () => {
expect(
isFreeFormAdhocFilter({
expressionType: 'SIMPLE',
diff --git a/superset-frontend/packages/superset-ui-core/test/time-comparison/customTimeRangeDecode.test.ts b/superset-frontend/packages/superset-ui-core/test/time-comparison/customTimeRangeDecode.test.ts
index b3384113482..043d48ebd56 100644
--- a/superset-frontend/packages/superset-ui-core/test/time-comparison/customTimeRangeDecode.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/time-comparison/customTimeRangeDecode.test.ts
@@ -20,7 +20,7 @@
import { customTimeRangeDecode } from '@superset-ui/core';
describe('customTimeRangeDecode', () => {
- it('1) specific : specific', () => {
+ test('1) specific : specific', () => {
expect(
customTimeRangeDecode('2021-01-20T00:00:00 : 2021-01-27T00:00:00'),
).toEqual({
@@ -40,7 +40,7 @@ describe('customTimeRangeDecode', () => {
});
});
- it('2) specific : relative', () => {
+ test('2) specific : relative', () => {
expect(
customTimeRangeDecode(
'2021-01-20T00:00:00 : DATEADD(DATETIME("2021-01-20T00:00:00"), 7, day)',
@@ -62,7 +62,7 @@ describe('customTimeRangeDecode', () => {
});
});
- it('3) relative : specific', () => {
+ test('3) relative : specific', () => {
expect(
customTimeRangeDecode(
'DATEADD(DATETIME("2021-01-27T00:00:00"), -7, day) : 2021-01-27T00:00:00',
@@ -84,7 +84,7 @@ describe('customTimeRangeDecode', () => {
});
});
- it('4) relative : relative (now)', () => {
+ test('4) relative : relative (now)', () => {
expect(
customTimeRangeDecode(
'DATEADD(DATETIME("now"), -7, day) : DATEADD(DATETIME("now"), 7, day)',
@@ -106,7 +106,7 @@ describe('customTimeRangeDecode', () => {
});
});
- it('5) relative : relative (date/time)', () => {
+ test('5) relative : relative (date/time)', () => {
expect(
customTimeRangeDecode(
'DATEADD(DATETIME("2021-01-27T00:00:00"), -7, day) : DATEADD(DATETIME("2021-01-27T00:00:00"), 7, day)',
@@ -128,7 +128,7 @@ describe('customTimeRangeDecode', () => {
});
});
- it('6) specific : relative (now)', () => {
+ test('6) specific : relative (now)', () => {
expect(
customTimeRangeDecode('now : DATEADD(DATETIME("now"), 7, day)'),
).toEqual({
@@ -148,7 +148,7 @@ describe('customTimeRangeDecode', () => {
});
});
- it('7) default', () => {
+ test('7) default', () => {
const SEVEN_DAYS_AGO = new Date();
const MIDNIGHT = new Date();
SEVEN_DAYS_AGO.setHours(0, 0, 0, 0);
@@ -174,7 +174,7 @@ describe('customTimeRangeDecode', () => {
});
});
- it('8) relative : relative return default', () => {
+ test('8) relative : relative return default', () => {
const SEVEN_DAYS_AGO = new Date();
SEVEN_DAYS_AGO.setHours(0, 0, 0, 0);
@@ -203,7 +203,7 @@ describe('customTimeRangeDecode', () => {
});
});
- it('9) empty string returns default', () => {
+ test('9) empty string returns default', () => {
const SEVEN_DAYS_AGO = new Date();
SEVEN_DAYS_AGO.setHours(0, 0, 0, 0);
@@ -229,7 +229,7 @@ describe('customTimeRangeDecode', () => {
});
});
- it('10) both undefined returns default', () => {
+ test('10) both undefined returns default', () => {
const SEVEN_DAYS_AGO = new Date();
SEVEN_DAYS_AGO.setHours(0, 0, 0, 0);
@@ -255,7 +255,7 @@ describe('customTimeRangeDecode', () => {
});
});
- it('11) 1 side undefined returns default', () => {
+ test('11) 1 side undefined returns default', () => {
const SEVEN_DAYS_AGO = new Date();
SEVEN_DAYS_AGO.setHours(0, 0, 0, 0);
diff --git a/superset-frontend/packages/superset-ui-core/test/time-comparison/getComparisonFilters.test.ts b/superset-frontend/packages/superset-ui-core/test/time-comparison/getComparisonFilters.test.ts
index 7bdbc16c4ee..67fc0e289eb 100644
--- a/superset-frontend/packages/superset-ui-core/test/time-comparison/getComparisonFilters.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/time-comparison/getComparisonFilters.test.ts
@@ -70,13 +70,13 @@ const mockExtraFormData = {
};
describe('getComparisonFilters', () => {
- it('Keeps the original adhoc_filters since no extra data was passed', () => {
+ test('Keeps the original adhoc_filters since no extra data was passed', () => {
const result = getComparisonFilters(form_data, {});
expect(result).toEqual(form_data.adhoc_filters);
});
- it('Updates the time_range if the filter if extra form data is passed', () => {
+ test('Updates the time_range if the filter if extra form data is passed', () => {
const result = getComparisonFilters(form_data, mockExtraFormData);
const expectedFilters = [
@@ -98,7 +98,7 @@ describe('getComparisonFilters', () => {
expect(result[0]).toEqual(expectedFilters[0]);
});
- it('handles no time range filters', () => {
+ test('handles no time range filters', () => {
const result = getComparisonFilters(
{
...form_data,
@@ -130,7 +130,7 @@ describe('getComparisonFilters', () => {
expect(result[0]).toEqual(expectedFilters[0]);
});
- it('If adhoc_filter is undefrined the code wont break', () => {
+ test('If adhoc_filter is undefrined the code wont break', () => {
const result = getComparisonFilters(
{
...form_data,
diff --git a/superset-frontend/packages/superset-ui-core/test/time-comparison/getComparisonInfo.test.ts b/superset-frontend/packages/superset-ui-core/test/time-comparison/getComparisonInfo.test.ts
index ffaa58f48f7..27312006611 100644
--- a/superset-frontend/packages/superset-ui-core/test/time-comparison/getComparisonInfo.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/time-comparison/getComparisonInfo.test.ts
@@ -79,7 +79,7 @@ const mockExtraFormData = {
};
describe('getComparisonInfo', () => {
- it('Keeps the original adhoc_filters since no extra data was passed', () => {
+ test('Keeps the original adhoc_filters since no extra data was passed', () => {
const resultFormData = getComparisonInfo(
form_data,
ComparisonTimeRangeType.Year,
@@ -88,7 +88,7 @@ describe('getComparisonInfo', () => {
expect(resultFormData).toEqual(form_data);
});
- it('Updates the time_range of the adhoc_filters when extra form data is passed', () => {
+ test('Updates the time_range of the adhoc_filters when extra form data is passed', () => {
const resultFormData = getComparisonInfo(
form_data,
ComparisonTimeRangeType.Month,
@@ -114,7 +114,7 @@ describe('getComparisonInfo', () => {
expect(resultFormData.adhoc_filters).toEqual(expectedFilters);
});
- it('handles no time range filters', () => {
+ test('handles no time range filters', () => {
const resultFormData = getComparisonInfo(
{
...form_data,
@@ -147,7 +147,7 @@ describe('getComparisonInfo', () => {
expect(resultFormData.adhoc_filters?.[0]).toEqual(expectedFilters[0]);
});
- it('If adhoc_filter is undefined the code wont break', () => {
+ test('If adhoc_filter is undefined the code wont break', () => {
const resultFormData = getComparisonInfo(
{
...form_data,
@@ -161,7 +161,7 @@ describe('getComparisonInfo', () => {
expect(resultFormData.adhoc_filters).toEqual([]);
});
- it('Handles the custom time filters and return the correct time shift text', () => {
+ test('Handles the custom time filters and return the correct time shift text', () => {
const resultFormData = getComparisonInfo(
form_data,
ComparisonTimeRangeType.Custom,
@@ -181,7 +181,7 @@ describe('getComparisonInfo', () => {
expect(resultFormData.adhoc_filters).toEqual(expectedFilters);
});
- it('Updates comparison display values when toggled', () => {
+ test('Updates comparison display values when toggled', () => {
const resultFormData = getComparisonInfo(
{
...form_data,
diff --git a/superset-frontend/packages/superset-ui-core/test/time-comparison/index.test.ts b/superset-frontend/packages/superset-ui-core/test/time-comparison/index.test.ts
index 9ff8a31ab77..752cbac174a 100644
--- a/superset-frontend/packages/superset-ui-core/test/time-comparison/index.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/time-comparison/index.test.ts
@@ -24,7 +24,7 @@ import {
} from '@superset-ui/core';
describe('index', () => {
- it('exports modules', () => {
+ test('exports modules', () => {
[ComparisonTimeRangeType, getComparisonFilters, getComparisonInfo].forEach(
x => expect(x).toBeDefined(),
);
diff --git a/superset-frontend/packages/superset-ui-core/test/time-format/TimeFormatter.test.ts b/superset-frontend/packages/superset-ui-core/test/time-format/TimeFormatter.test.ts
index 6334c93d4e4..2edad835bb6 100644
--- a/superset-frontend/packages/superset-ui-core/test/time-format/TimeFormatter.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/time-format/TimeFormatter.test.ts
@@ -21,7 +21,7 @@ import { TimeFormatter, PREVIEW_TIME } from '@superset-ui/core';
describe('TimeFormatter', () => {
describe('new TimeFormatter(config)', () => {
- it('requires config.id', () => {
+ test('requires config.id', () => {
expect(
() =>
// @ts-expect-error -- intentionally pass invalid input
@@ -30,7 +30,7 @@ describe('TimeFormatter', () => {
}),
).toThrow();
});
- it('requires config.formatFunc', () => {
+ test('requires config.formatFunc', () => {
expect(
() =>
// @ts-expect-error -- intentionally pass invalid input
@@ -45,10 +45,10 @@ describe('TimeFormatter', () => {
id: 'year_only',
formatFunc: (value: Date) => `${value.getFullYear()}`,
});
- it('returns formatted value', () => {
+ test('returns formatted value', () => {
expect(formatter(PREVIEW_TIME)).toEqual('2017');
});
- it('formatter(value) is the same with formatter.format(value)', () => {
+ test('formatter(value) is the same with formatter.format(value)', () => {
const value = PREVIEW_TIME;
expect(formatter(value)).toEqual(formatter.format(value));
});
@@ -58,16 +58,16 @@ describe('TimeFormatter', () => {
id: 'year_only',
formatFunc: value => `${value.getFullYear()}`,
});
- it('handles null', () => {
+ test('handles null', () => {
expect(formatter.format(null)).toEqual('null');
});
- it('handles undefined', () => {
+ test('handles undefined', () => {
expect(formatter.format(undefined)).toEqual('undefined');
});
- it('handles number, treating it as a timestamp', () => {
+ test('handles number, treating it as a timestamp', () => {
expect(formatter.format(PREVIEW_TIME.getTime())).toEqual('2017');
});
- it('otherwise returns formatted value', () => {
+ test('otherwise returns formatted value', () => {
expect(formatter.format(PREVIEW_TIME)).toEqual('2017');
});
});
@@ -76,13 +76,13 @@ describe('TimeFormatter', () => {
id: 'year_only',
formatFunc: value => `${value.getFullYear()}`,
});
- it('returns string comparing value before and after formatting', () => {
+ test('returns string comparing value before and after formatting', () => {
const time = new Date(Date.UTC(2018, 10, 21, 22, 11, 44));
expect(formatter.preview(time)).toEqual(
'Wed, 21 Nov 2018 22:11:44 GMT => 2018',
);
});
- it('uses the default preview value if not specified', () => {
+ test('uses the default preview value if not specified', () => {
expect(formatter.preview()).toEqual(
'Tue, 14 Feb 2017 11:22:33 GMT => 2017',
);
diff --git a/superset-frontend/packages/superset-ui-core/test/time-format/TimeFormatterRegistry.test.ts b/superset-frontend/packages/superset-ui-core/test/time-format/TimeFormatterRegistry.test.ts
index 8ae78b49730..a308666e01d 100644
--- a/superset-frontend/packages/superset-ui-core/test/time-format/TimeFormatterRegistry.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/time-format/TimeFormatterRegistry.test.ts
@@ -28,45 +28,45 @@ describe('TimeFormatterRegistry', () => {
registry = new TimeFormatterRegistry();
});
describe('.get(format)', () => {
- it('creates and returns a new formatter if does not exist', () => {
+ test('creates and returns a new formatter if does not exist', () => {
const formatter = registry.get(TimeFormats.DATABASE_DATETIME);
expect(formatter).toBeInstanceOf(TimeFormatter);
expect(formatter.format(PREVIEW_TIME)).toEqual('2017-02-14 11:22:33');
});
- it('returns an existing formatter if already exists', () => {
+ test('returns an existing formatter if already exists', () => {
const formatter = registry.get(TimeFormats.TIME);
const formatter2 = registry.get(TimeFormats.TIME);
expect(formatter).toBe(formatter2);
});
- it('falls back to default format if format is not specified', () => {
+ test('falls back to default format if format is not specified', () => {
registry.setDefaultKey(TimeFormats.INTERNATIONAL_DATE);
const formatter = registry.get();
expect(formatter.format(PREVIEW_TIME)).toEqual('14/02/2017');
});
- it('falls back to default format if format is null', () => {
+ test('falls back to default format if format is null', () => {
registry.setDefaultKey(TimeFormats.INTERNATIONAL_DATE);
// @ts-expect-error
const formatter = registry.get(null);
expect(formatter.format(PREVIEW_TIME)).toEqual('14/02/2017');
});
- it('falls back to default format if format is undefined', () => {
+ test('falls back to default format if format is undefined', () => {
registry.setDefaultKey(TimeFormats.INTERNATIONAL_DATE);
const formatter = registry.get(undefined);
expect(formatter.format(PREVIEW_TIME)).toEqual('14/02/2017');
});
- it('falls back to default format if format is empty string', () => {
+ test('falls back to default format if format is empty string', () => {
registry.setDefaultKey(TimeFormats.INTERNATIONAL_DATE);
const formatter = registry.get('');
expect(formatter.format(PREVIEW_TIME)).toEqual('14/02/2017');
});
- it('removes leading and trailing spaces from format', () => {
+ test('removes leading and trailing spaces from format', () => {
const formatter = registry.get(' %Y ');
expect(formatter).toBeInstanceOf(TimeFormatter);
expect(formatter.format(PREVIEW_TIME)).toEqual('2017');
});
});
describe('.format(format, value)', () => {
- it('return the value with the specified format', () => {
+ test('return the value with the specified format', () => {
expect(registry.format(TimeFormats.US_DATE, PREVIEW_TIME)).toEqual(
'02/14/2017',
);
@@ -74,7 +74,7 @@ describe('TimeFormatterRegistry', () => {
'11:22:33',
);
});
- it('falls back to the default formatter if the format is undefined', () => {
+ test('falls back to the default formatter if the format is undefined', () => {
expect(registry.format(undefined, PREVIEW_TIME)).toEqual(
'2017-02-14 11:22:33',
);
@@ -98,22 +98,22 @@ describe('TimeFormatterRegistry', () => {
registry.setD3Format(timeFormat);
});
- it('sets the specified value and default', () => {
+ test('sets the specified value and default', () => {
expect(registry.d3Format).toEqual({
...DEFAULT_D3_TIME_FORMAT,
...timeFormat,
});
});
- it('does not change short days of week name format', () => {
+ test('does not change short days of week name format', () => {
expect(registry.format('%a', PREVIEW_TIME)).toEqual('Tue');
});
- it('changes full days of week name format', () => {
+ test('changes full days of week name format', () => {
expect(registry.format('%A', PREVIEW_TIME)).toEqual('Terça');
});
- it('does not change months format', () => {
+ test('does not change months format', () => {
expect(registry.format('%b', PREVIEW_TIME)).toEqual('Feb');
expect(registry.format('%B', PREVIEW_TIME)).toEqual('February');
});
@@ -169,16 +169,16 @@ describe('TimeFormatterRegistry', () => {
registry.setD3Format(timeFormat);
});
- it('sets the specified value ignoring default', () => {
+ test('sets the specified value ignoring default', () => {
expect(registry.d3Format).toEqual(timeFormat);
});
- it('changes days of week format', () => {
+ test('changes days of week format', () => {
expect(registry.format('%a', PREVIEW_TIME)).toEqual('Ter');
expect(registry.format('%A', PREVIEW_TIME)).toEqual('Terça');
});
- it('changes months format', () => {
+ test('changes months format', () => {
expect(registry.format('%b', PREVIEW_TIME)).toEqual('Fev');
expect(registry.format('%B', PREVIEW_TIME)).toEqual('Fevereiro');
});
diff --git a/superset-frontend/packages/superset-ui-core/test/time-format/TimeFormatterRegistrySingleton.test.ts b/superset-frontend/packages/superset-ui-core/test/time-format/TimeFormatterRegistrySingleton.test.ts
index b0a0c0306fb..ec0c1da5519 100644
--- a/superset-frontend/packages/superset-ui-core/test/time-format/TimeFormatterRegistrySingleton.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/time-format/TimeFormatterRegistrySingleton.test.ts
@@ -31,26 +31,26 @@ import TimeFormatterRegistry from '../../src/time-format/TimeFormatterRegistry';
describe('TimeFormatterRegistrySingleton', () => {
describe('getTimeFormatterRegistry()', () => {
- it('returns a TimeFormatterRegistry', () => {
+ test('returns a TimeFormatterRegistry', () => {
expect(getTimeFormatterRegistry()).toBeInstanceOf(TimeFormatterRegistry);
});
});
describe('getTimeFormatter(format)', () => {
- it('returns a format function', () => {
+ test('returns a format function', () => {
const format = getTimeFormatter('%d/%m/%Y');
expect(format(PREVIEW_TIME)).toEqual('14/02/2017');
});
- it('falls back to default format if format is not specified', () => {
+ test('falls back to default format if format is not specified', () => {
const format = getTimeFormatter();
expect(format(PREVIEW_TIME)).toEqual('2017-02-14 11:22:33');
});
- it(`use local time when format string has LOCAL_PREFIX (${LOCAL_PREFIX})`, () => {
+ test(`use local time when format string has LOCAL_PREFIX (${LOCAL_PREFIX})`, () => {
const format = getTimeFormatter('local!%m-%d %H:%M');
expect(format(new Date(2019, 5, 18, 11, 23))).toEqual('06-18 11:23');
});
});
describe('getTimeFormatterForGranularity(granularity?)', () => {
- it('returns the default formatter for that granularity', () => {
+ test('returns the default formatter for that granularity', () => {
const date = new Date(Date.UTC(2020, 4, 10)); // May 10, 2020 is Sunday
expect(
getTimeFormatterForGranularity(TimeGranularity.DATE)(date),
@@ -58,7 +58,7 @@ describe('TimeFormatterRegistrySingleton', () => {
});
});
describe('formatTimeRange(format?, values)', () => {
- it('format the given time range with specified format', () => {
+ test('format the given time range with specified format', () => {
expect(
formatTimeRange('%m-%d', [
new Date(Date.UTC(2017, 1, 1)),
@@ -66,7 +66,7 @@ describe('TimeFormatterRegistrySingleton', () => {
]),
).toEqual('02-01 — 02-02');
});
- it('show only one value if start and end are equal after formatting', () => {
+ test('show only one value if start and end are equal after formatting', () => {
expect(
formatTimeRange('%m-%d', [
new Date(Date.UTC(2017, 1, 1)),
@@ -74,7 +74,7 @@ describe('TimeFormatterRegistrySingleton', () => {
]),
).toEqual('02-01');
});
- it('falls back to default format if format is not specified', () => {
+ test('falls back to default format if format is not specified', () => {
expect(
formatTimeRange(undefined, [
new Date(Date.UTC(2017, 1, 1)),
@@ -85,18 +85,18 @@ describe('TimeFormatterRegistrySingleton', () => {
});
describe('formatTime(format?, value, granularity?)', () => {
describe('without granularity', () => {
- it('format the given time using the specified format', () => {
+ test('format the given time using the specified format', () => {
const output = formatTime('%Y-%m-%d', PREVIEW_TIME);
expect(output).toEqual('2017-02-14');
});
- it('falls back to the default formatter if the format is undefined', () => {
+ test('falls back to the default formatter if the format is undefined', () => {
expect(formatTime(undefined, PREVIEW_TIME)).toEqual(
'2017-02-14 11:22:33',
);
});
});
describe('with granularity', () => {
- it('format the given time using specified format', () => {
+ test('format the given time using specified format', () => {
const output = formatTime(
'%-m/%d',
new Date(Date.UTC(2017, 4, 10)),
@@ -104,7 +104,7 @@ describe('TimeFormatterRegistrySingleton', () => {
);
expect(output).toEqual('5/10 — 5/16');
});
- it('format the given time using default format if format is not specified', () => {
+ test('format the given time using default format if format is not specified', () => {
const date = new Date(Date.UTC(2020, 4, 10)); // May 10, 2020 is Sunday
expect(formatTime(undefined, date, TimeGranularity.DATE)).toEqual(
'2020-05-10',
diff --git a/superset-frontend/packages/superset-ui-core/test/time-format/factories/createD3TimeFormatter.test.ts b/superset-frontend/packages/superset-ui-core/test/time-format/factories/createD3TimeFormatter.test.ts
index 22a45c9e797..dbc54628045 100644
--- a/superset-frontend/packages/superset-ui-core/test/time-format/factories/createD3TimeFormatter.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/time-format/factories/createD3TimeFormatter.test.ts
@@ -70,20 +70,20 @@ const thLocale: TimeLocaleDefinition = {
};
describe('createD3TimeFormatter(config)', () => {
- it('requires config.formatString', () => {
+ test('requires config.formatString', () => {
// @ts-expect-error
expect(() => createD3TimeFormatter()).toThrow();
// @ts-expect-error
expect(() => createD3TimeFormatter({})).toThrow();
});
describe('config.useLocalTime', () => {
- it('if falsy, formats in UTC time', () => {
+ test('if falsy, formats in UTC time', () => {
const formatter = createD3TimeFormatter({
formatString: TimeFormats.DATABASE_DATETIME,
});
expect(formatter.format(PREVIEW_TIME)).toEqual('2017-02-14 11:22:33');
});
- it('if true, formats in local time', () => {
+ test('if true, formats in local time', () => {
const formatter = createD3TimeFormatter({
formatString: TimeFormats.DATABASE_DATETIME,
useLocalTime: true,
@@ -104,14 +104,14 @@ describe('createD3TimeFormatter(config)', () => {
describe('config.locale', () => {
const TEST_TIME = new Date(Date.UTC(2015, 11, 20));
- it('supports locale customization (utc time)', () => {
+ test('supports locale customization (utc time)', () => {
const formatter = createD3TimeFormatter({
formatString: '%c',
locale: thLocale,
});
expect(formatter(TEST_TIME)).toEqual('à¸à¸². 20 ธ.ค. 2015 00:00:00');
});
- it('supports locale customization (local time)', () => {
+ test('supports locale customization (local time)', () => {
const formatter = createD3TimeFormatter({
formatString: '%c',
locale: thLocale,
diff --git a/superset-frontend/packages/superset-ui-core/test/time-format/factories/createMultiFormatter.test.ts b/superset-frontend/packages/superset-ui-core/test/time-format/factories/createMultiFormatter.test.ts
index deaf00ff168..f3d5486d4ff 100644
--- a/superset-frontend/packages/superset-ui-core/test/time-format/factories/createMultiFormatter.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/time-format/factories/createMultiFormatter.test.ts
@@ -28,30 +28,30 @@ describe('createMultiFormatter()', () => {
id: 'my_format',
useLocalTime: false,
});
- it('formats millisecond', () => {
+ test('formats millisecond', () => {
expect(formatter(new Date(2018, 10, 20, 11, 22, 33, 100))).toEqual(
'.100',
);
});
- it('formats second', () => {
+ test('formats second', () => {
expect(formatter(new Date(2018, 10, 20, 11, 22, 33))).toEqual(':33');
});
- it('format minutes', () => {
+ test('format minutes', () => {
expect(formatter(new Date(2018, 10, 20, 11, 22))).toEqual('04:22');
});
- it('format hours', () => {
+ test('format hours', () => {
expect(formatter(new Date('2018-11-18 11:00 UTC'))).toEqual('11 AM');
});
- it('format first day of week', () => {
+ test('format first day of week', () => {
expect(formatter(new Date('2018-11-18 UTC'))).toEqual('Nov 18');
});
- it('format other day of week', () => {
+ test('format other day of week', () => {
expect(formatter(new Date('2018-11-20 UTC'))).toEqual('Tue 20');
});
- it('format month', () => {
+ test('format month', () => {
expect(formatter(new Date('2018-11-1 UTC'))).toEqual('November');
});
- it('format year', () => {
+ test('format year', () => {
expect(formatter(new Date('2018-1-1 UTC'))).toEqual('2018');
});
});
@@ -60,30 +60,30 @@ describe('createMultiFormatter()', () => {
id: 'my_format',
useLocalTime: true,
});
- it('formats millisecond', () => {
+ test('formats millisecond', () => {
expect(formatter(new Date(2018, 10, 20, 11, 22, 33, 100))).toEqual(
'.100',
);
});
- it('formats second', () => {
+ test('formats second', () => {
expect(formatter(new Date(2018, 10, 20, 11, 22, 33))).toEqual(':33');
});
- it('format minutes', () => {
+ test('format minutes', () => {
expect(formatter(new Date(2018, 10, 20, 11, 22))).toEqual('11:22');
});
- it('format hours', () => {
+ test('format hours', () => {
expect(formatter(new Date(2018, 10, 20, 11))).toEqual('11 AM');
});
- it('format first day of week', () => {
+ test('format first day of week', () => {
expect(formatter(new Date(2018, 10, 18))).toEqual('Nov 18');
});
- it('format other day of week', () => {
+ test('format other day of week', () => {
expect(formatter(new Date(2018, 10, 20))).toEqual('Tue 20');
});
- it('format month', () => {
+ test('format month', () => {
expect(formatter(new Date(2018, 10))).toEqual('November');
});
- it('format year', () => {
+ test('format year', () => {
expect(formatter(new Date(2018, 0))).toEqual('2018');
});
});
@@ -140,30 +140,30 @@ describe('createMultiFormatter()', () => {
useLocalTime: false,
locale,
});
- it('formats millisecond', () => {
+ test('formats millisecond', () => {
expect(formatter(new Date(2018, 10, 20, 11, 22, 33, 100))).toEqual(
'.100',
);
});
- it('formats second', () => {
+ test('formats second', () => {
expect(formatter(new Date(2018, 10, 20, 11, 22, 33))).toEqual(':33');
});
- it('format minutes', () => {
+ test('format minutes', () => {
expect(formatter(new Date(2018, 10, 20, 11, 22))).toEqual('04:22');
});
- it('format hours', () => {
+ test('format hours', () => {
expect(formatter(new Date('2018-11-18 11:00 UTC'))).toEqual('11 AM');
});
- it('format first day of week', () => {
+ test('format first day of week', () => {
expect(formatter(new Date('2018-11-18 UTC'))).toEqual('Nov 18');
});
- it('format other day of week', () => {
+ test('format other day of week', () => {
expect(formatter(new Date('2018-11-20 UTC'))).toEqual('Ter 20');
});
- it('format month', () => {
+ test('format month', () => {
expect(formatter(new Date('2018-11-1 UTC'))).toEqual('Novembro');
});
- it('format year', () => {
+ test('format year', () => {
expect(formatter(new Date('2018-1-1 UTC'))).toEqual('2018');
});
});
@@ -173,30 +173,30 @@ describe('createMultiFormatter()', () => {
useLocalTime: true,
locale,
});
- it('formats millisecond', () => {
+ test('formats millisecond', () => {
expect(formatter(new Date(2018, 10, 20, 11, 22, 33, 100))).toEqual(
'.100',
);
});
- it('formats second', () => {
+ test('formats second', () => {
expect(formatter(new Date(2018, 10, 20, 11, 22, 33))).toEqual(':33');
});
- it('format minutes', () => {
+ test('format minutes', () => {
expect(formatter(new Date(2018, 10, 20, 11, 22))).toEqual('11:22');
});
- it('format hours', () => {
+ test('format hours', () => {
expect(formatter(new Date(2018, 10, 20, 11))).toEqual('11 AM');
});
- it('format first day of week', () => {
+ test('format first day of week', () => {
expect(formatter(new Date(2018, 10, 18))).toEqual('Nov 18');
});
- it('format other day of week', () => {
+ test('format other day of week', () => {
expect(formatter(new Date(2018, 10, 20))).toEqual('Ter 20');
});
- it('format month', () => {
+ test('format month', () => {
expect(formatter(new Date(2018, 10))).toEqual('Novembro');
});
- it('format year', () => {
+ test('format year', () => {
expect(formatter(new Date(2018, 0))).toEqual('2018');
});
});
diff --git a/superset-frontend/packages/superset-ui-core/test/time-format/formatters/smartDate.test.ts b/superset-frontend/packages/superset-ui-core/test/time-format/formatters/smartDate.test.ts
index 3109da0fb69..6f2a4e3e08f 100644
--- a/superset-frontend/packages/superset-ui-core/test/time-format/formatters/smartDate.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/time-format/formatters/smartDate.test.ts
@@ -24,23 +24,23 @@ describe('createSmartDateFormatter', () => {
describe('when locale is default', () => {
const smartDateFormatter = createSmartDateFormatter();
- it('is a function', () => {
+ test('is a function', () => {
expect(smartDateFormatter).toBeInstanceOf(TimeFormatter);
});
- it('shows only year when 1st day of the year', () => {
+ test('shows only year when 1st day of the year', () => {
expect(smartDateFormatter(new Date('2020-01-01'))).toBe('2020');
});
- it('shows only month when 1st of month', () => {
+ test('shows only month when 1st of month', () => {
expect(smartDateFormatter(new Date('2020-03-01'))).toBe('March');
});
- it('does not show day of week when it is Sunday', () => {
+ test('does not show day of week when it is Sunday', () => {
expect(smartDateFormatter(new Date('2020-03-15'))).toBe('Mar 15');
});
- it('shows weekday when it is not Sunday (and no ms/sec/min/hr)', () => {
+ test('shows weekday when it is not Sunday (and no ms/sec/min/hr)', () => {
expect(smartDateFormatter(new Date('2020-03-03'))).toBe('Tue 03');
});
});
@@ -91,23 +91,23 @@ describe('createSmartDateFormatter', () => {
};
const smartDateFormatter = createSmartDateFormatter(locale);
- it('is a function', () => {
+ test('is a function', () => {
expect(smartDateFormatter).toBeInstanceOf(TimeFormatter);
});
- it('shows only year when 1st day of the year', () => {
+ test('shows only year when 1st day of the year', () => {
expect(smartDateFormatter(new Date('2020-01-01'))).toBe('2020');
});
- it('shows only month when 1st of month', () => {
+ test('shows only month when 1st of month', () => {
expect(smartDateFormatter(new Date('2020-03-01'))).toBe('Março');
});
- it('does not show day of week when it is Sunday', () => {
+ test('does not show day of week when it is Sunday', () => {
expect(smartDateFormatter(new Date('2023-10-15'))).toBe('Out 15');
});
- it('shows weekday when it is not Sunday (and no ms/sec/min/hr)', () => {
+ test('shows weekday when it is not Sunday (and no ms/sec/min/hr)', () => {
expect(smartDateFormatter(new Date('2020-03-03'))).toBe('Ter 03');
});
});
diff --git a/superset-frontend/packages/superset-ui-core/test/time-format/formatters/smartDateDetailed.test.ts b/superset-frontend/packages/superset-ui-core/test/time-format/formatters/smartDateDetailed.test.ts
index c47c468052f..29912b2949e 100644
--- a/superset-frontend/packages/superset-ui-core/test/time-format/formatters/smartDateDetailed.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/time-format/formatters/smartDateDetailed.test.ts
@@ -27,33 +27,33 @@ describe('smartDateDetailedFormatter', () => {
describe('when locale is default', () => {
const formatter = createSmartDateDetailedFormatter();
- it('is a function', () => {
+ test('is a function', () => {
expect(formatter).toBeInstanceOf(TimeFormatter);
});
- it('shows only year when 1st day of the year', () => {
+ test('shows only year when 1st day of the year', () => {
expect(formatter(new Date('2020-01-01T00:00:00.000+00:00'))).toBe('2020');
});
- it('shows full date when a regular date', () => {
+ test('shows full date when a regular date', () => {
expect(formatter(new Date('2020-03-01T00:00:00.000+00:00'))).toBe(
'2020-03-01',
);
});
- it('shows full date including time of day without seconds when hour precision', () => {
+ test('shows full date including time of day without seconds when hour precision', () => {
expect(formatter(new Date('2020-03-01T13:00:00.000+00:00'))).toBe(
'2020-03-01 13:00',
);
});
- it('shows full date including time of day when minute precision', () => {
+ test('shows full date including time of day when minute precision', () => {
expect(formatter(new Date('2020-03-10T13:10:00.000+00:00'))).toBe(
'2020-03-10 13:10',
);
});
- it('shows full date including time of day when subsecond precision', () => {
+ test('shows full date including time of day when subsecond precision', () => {
expect(formatter(new Date('2020-03-10T13:10:00.100+00:00'))).toBe(
'2020-03-10 13:10:00.100',
);
@@ -106,33 +106,33 @@ describe('smartDateDetailedFormatter', () => {
};
const formatter = createSmartDateDetailedFormatter(locale);
- it('is a function', () => {
+ test('is a function', () => {
expect(formatter).toBeInstanceOf(TimeFormatter);
});
- it('shows only year when 1st day of the year', () => {
+ test('shows only year when 1st day of the year', () => {
expect(formatter(new Date('2020-01-01T00:00:00.000+00:00'))).toBe('2020');
});
- it('shows full date when a regular date', () => {
+ test('shows full date when a regular date', () => {
expect(formatter(new Date('2020-03-01T00:00:00.000+00:00'))).toBe(
'2020-03-01',
);
});
- it('shows full date including time of day without seconds when hour precision', () => {
+ test('shows full date including time of day without seconds when hour precision', () => {
expect(formatter(new Date('2020-03-01T13:00:00.000+00:00'))).toBe(
'2020-03-01 13:00',
);
});
- it('shows full date including time of day when minute precision', () => {
+ test('shows full date including time of day when minute precision', () => {
expect(formatter(new Date('2020-03-10T13:10:00.000+00:00'))).toBe(
'2020-03-10 13:10',
);
});
- it('shows full date including time of day when subsecond precision', () => {
+ test('shows full date including time of day when subsecond precision', () => {
expect(formatter(new Date('2020-03-10T13:10:00.100+00:00'))).toBe(
'2020-03-10 13:10:00.100',
);
diff --git a/superset-frontend/packages/superset-ui-core/test/time-format/formatters/smartDateVerbose.test.ts b/superset-frontend/packages/superset-ui-core/test/time-format/formatters/smartDateVerbose.test.ts
index aaf6e76a132..4443f5a633e 100644
--- a/superset-frontend/packages/superset-ui-core/test/time-format/formatters/smartDateVerbose.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/time-format/formatters/smartDateVerbose.test.ts
@@ -27,19 +27,19 @@ describe('smartDateVerboseFormatter', () => {
describe('when locale is default', () => {
const formatter = createSmartDateVerboseFormatter();
- it('is a function', () => {
+ test('is a function', () => {
expect(formatter).toBeInstanceOf(TimeFormatter);
});
- it('shows only year when 1st day of the year', () => {
+ test('shows only year when 1st day of the year', () => {
expect(formatter(new Date('2020-01-01'))).toBe('2020');
});
- it('shows month and year when 1st of month', () => {
+ test('shows month and year when 1st of month', () => {
expect(formatter(new Date('2020-03-01'))).toBe('Mar 2020');
});
- it('shows weekday when any day of the month', () => {
+ test('shows weekday when any day of the month', () => {
expect(formatter(new Date('2020-03-03'))).toBe('Tue Mar 3');
expect(formatter(new Date('2020-03-15'))).toBe('Sun Mar 15');
});
@@ -91,19 +91,19 @@ describe('smartDateVerboseFormatter', () => {
};
const formatter = createSmartDateVerboseFormatter(locale);
- it('is a function', () => {
+ test('is a function', () => {
expect(formatter).toBeInstanceOf(TimeFormatter);
});
- it('shows only year when 1st day of the year', () => {
+ test('shows only year when 1st day of the year', () => {
expect(formatter(new Date('2020-01-01'))).toBe('2020');
});
- it('shows month and year when 1st of month', () => {
+ test('shows month and year when 1st of month', () => {
expect(formatter(new Date('2020-04-01'))).toBe('Abr 2020');
});
- it('shows weekday when any day of the month', () => {
+ test('shows weekday when any day of the month', () => {
expect(formatter(new Date('2020-03-03'))).toBe('Ter Mar 3');
expect(formatter(new Date('2020-03-15'))).toBe('Dom Mar 15');
});
diff --git a/superset-frontend/packages/superset-ui-core/test/time-format/index.test.ts b/superset-frontend/packages/superset-ui-core/test/time-format/index.test.ts
index 1ac7719c0a0..62deda9badd 100644
--- a/superset-frontend/packages/superset-ui-core/test/time-format/index.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/time-format/index.test.ts
@@ -36,7 +36,7 @@ import {
} from '@superset-ui/core';
describe('index', () => {
- it('exports modules', () => {
+ test('exports modules', () => {
[
createD3TimeFormatter,
createMultiFormatter,
diff --git a/superset-frontend/packages/superset-ui-core/test/time-format/utils/createTime.test.ts b/superset-frontend/packages/superset-ui-core/test/time-format/utils/createTime.test.ts
index 39629c5b84e..28f1d56cf9d 100644
--- a/superset-frontend/packages/superset-ui-core/test/time-format/utils/createTime.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/time-format/utils/createTime.test.ts
@@ -21,20 +21,20 @@ import createTime from '../../../src/time-format/utils/createTime';
describe('createTime(mode, year, month, date, hours, minutes, seconds, milliseconds)', () => {
describe('mode', () => {
- it('creates UTC time when mode==="utc"', () => {
+ test('creates UTC time when mode==="utc"', () => {
const time = createTime('utc', 2020, 5, 15);
expect(time.getUTCFullYear()).toEqual(2020);
expect(time.getUTCMonth()).toEqual(5);
expect(time.getUTCDate()).toEqual(15);
});
- it('creates local time when mode==="local"', () => {
+ test('creates local time when mode==="local"', () => {
const time = createTime('local', 2020, 5, 15);
expect(time.getFullYear()).toEqual(2020);
expect(time.getMonth()).toEqual(5);
expect(time.getDate()).toEqual(15);
});
});
- it('sets all the date parts', () => {
+ test('sets all the date parts', () => {
const time = createTime('local', 2020, 5, 15, 1, 2, 3, 4);
expect(time.getFullYear()).toEqual(2020);
expect(time.getMonth()).toEqual(5);
@@ -44,7 +44,7 @@ describe('createTime(mode, year, month, date, hours, minutes, seconds, milliseco
expect(time.getSeconds()).toEqual(3);
expect(time.getMilliseconds()).toEqual(4);
});
- it('sets default values for date parts', () => {
+ test('sets default values for date parts', () => {
const time = createTime('utc', 2020);
expect(time.getUTCMonth()).toEqual(0);
expect(time.getUTCDate()).toEqual(1);
diff --git a/superset-frontend/packages/superset-ui-core/test/time-format/utils/createTimeRangeFromGranularity.test.ts b/superset-frontend/packages/superset-ui-core/test/time-format/utils/createTimeRangeFromGranularity.test.ts
index 50c12dd8ed3..4c50ec00bf7 100644
--- a/superset-frontend/packages/superset-ui-core/test/time-format/utils/createTimeRangeFromGranularity.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/time-format/utils/createTimeRangeFromGranularity.test.ts
@@ -67,7 +67,7 @@ function testLocal(
describe('createTimeRangeFromGranularity(time, granularity, useLocalTime)', () => {
describe('UTC time', () => {
- it('creates time range according to specified granularity', () => {
+ test('creates time range according to specified granularity', () => {
expect(testUTC(TimeGranularity.DATE, 2020, 4, 15)).toEqual(
'2020-05-15 00:00:00.000 — 2020-05-15 23:59:59.999',
);
@@ -128,7 +128,7 @@ describe('createTimeRangeFromGranularity(time, granularity, useLocalTime)', () =
});
});
describe('Local time', () => {
- it('creates time range according to specified granularity', () => {
+ test('creates time range according to specified granularity', () => {
expect(testLocal(TimeGranularity.DATE, 2020, 4, 15)).toEqual(
'2020-05-15 00:00:00.000 — 2020-05-15 23:59:59.999',
);
diff --git a/superset-frontend/packages/superset-ui-core/test/time-format/utils/d3Time.test.ts b/superset-frontend/packages/superset-ui-core/test/time-format/utils/d3Time.test.ts
index ec36563e0af..e29a3843aed 100644
--- a/superset-frontend/packages/superset-ui-core/test/time-format/utils/d3Time.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/time-format/utils/d3Time.test.ts
@@ -24,43 +24,43 @@ import {
describe('utils', () => {
describe('utcUtils', () => {
- it('has isNotFirstDayOfWeekStartOnSunday', () => {
+ test('has isNotFirstDayOfWeekStartOnSunday', () => {
const date = new Date(Date.UTC(2018, 10, 19));
expect(utcUtils.isNotFirstDayOfWeekStartOnSunday(date)).toBeTruthy();
const date2 = new Date(Date.UTC(2018, 10, 18));
expect(utcUtils.isNotFirstDayOfWeekStartOnSunday(date2)).toBeFalsy();
});
- it('has isNotFirstDayOfWeekStartOnMonday', () => {
+ test('has isNotFirstDayOfWeekStartOnMonday', () => {
const date = new Date(Date.UTC(2018, 10, 20));
expect(utcUtils.isNotFirstDayOfWeekStartOnMonday(date)).toBeTruthy();
const date2 = new Date(Date.UTC(2018, 10, 19));
expect(utcUtils.isNotFirstDayOfWeekStartOnMonday(date2)).toBeFalsy();
});
- it('has isNotFirstDayOfWeekStartOnTuesday', () => {
+ test('has isNotFirstDayOfWeekStartOnTuesday', () => {
const date = new Date(Date.UTC(2018, 10, 21));
expect(utcUtils.isNotFirstDayOfWeekStartOnTuesday(date)).toBeTruthy();
const date2 = new Date(Date.UTC(2018, 10, 20));
expect(utcUtils.isNotFirstDayOfWeekStartOnTuesday(date2)).toBeFalsy();
});
- it('has isNotFirstDayOfWeekStartOnWednesday', () => {
+ test('has isNotFirstDayOfWeekStartOnWednesday', () => {
const date = new Date(Date.UTC(2018, 10, 22));
expect(utcUtils.isNotFirstDayOfWeekStartOnWednesday(date)).toBeTruthy();
const date2 = new Date(Date.UTC(2018, 10, 21));
expect(utcUtils.isNotFirstDayOfWeekStartOnWednesday(date2)).toBeFalsy();
});
- it('has isNotFirstDayOfWeekStartOnThursday', () => {
+ test('has isNotFirstDayOfWeekStartOnThursday', () => {
const date = new Date(Date.UTC(2018, 10, 23));
expect(utcUtils.isNotFirstDayOfWeekStartOnThursday(date)).toBeTruthy();
const date2 = new Date(Date.UTC(2018, 10, 22));
expect(utcUtils.isNotFirstDayOfWeekStartOnThursday(date2)).toBeFalsy();
});
- it('has isNotFirstDayOfWeekStartOnFriday', () => {
+ test('has isNotFirstDayOfWeekStartOnFriday', () => {
const date = new Date(Date.UTC(2018, 10, 24));
expect(utcUtils.isNotFirstDayOfWeekStartOnFriday(date)).toBeTruthy();
const date2 = new Date(Date.UTC(2018, 10, 23));
expect(utcUtils.isNotFirstDayOfWeekStartOnFriday(date2)).toBeFalsy();
});
- it('has isNotFirstDayOfWeekStartOnSaturday', () => {
+ test('has isNotFirstDayOfWeekStartOnSaturday', () => {
const date = new Date(Date.UTC(2018, 10, 25));
expect(utcUtils.isNotFirstDayOfWeekStartOnSaturday(date)).toBeTruthy();
const date2 = new Date(Date.UTC(2018, 10, 24));
@@ -68,7 +68,7 @@ describe('utils', () => {
});
});
describe('localTimeUtils', () => {
- it('has isNotFirstDayOfWeekStartOnSunday', () => {
+ test('has isNotFirstDayOfWeekStartOnSunday', () => {
const date = new Date(2018, 10, 19);
expect(
localTimeUtils.isNotFirstDayOfWeekStartOnSunday(date),
@@ -78,7 +78,7 @@ describe('utils', () => {
localTimeUtils.isNotFirstDayOfWeekStartOnSunday(date2),
).toBeFalsy();
});
- it('has isNotFirstDayOfWeekStartOnMonday', () => {
+ test('has isNotFirstDayOfWeekStartOnMonday', () => {
const date = new Date(2018, 10, 20);
expect(
localTimeUtils.isNotFirstDayOfWeekStartOnMonday(date),
@@ -88,7 +88,7 @@ describe('utils', () => {
localTimeUtils.isNotFirstDayOfWeekStartOnMonday(date2),
).toBeFalsy();
});
- it('has isNotFirstDayOfWeekStartOnTuesday', () => {
+ test('has isNotFirstDayOfWeekStartOnTuesday', () => {
const date = new Date(2018, 10, 21);
expect(
localTimeUtils.isNotFirstDayOfWeekStartOnTuesday(date),
@@ -98,7 +98,7 @@ describe('utils', () => {
localTimeUtils.isNotFirstDayOfWeekStartOnTuesday(date2),
).toBeFalsy();
});
- it('has isNotFirstDayOfWeekStartOnWednesday', () => {
+ test('has isNotFirstDayOfWeekStartOnWednesday', () => {
const date = new Date(2018, 10, 22);
expect(
localTimeUtils.isNotFirstDayOfWeekStartOnWednesday(date),
@@ -108,7 +108,7 @@ describe('utils', () => {
localTimeUtils.isNotFirstDayOfWeekStartOnWednesday(date2),
).toBeFalsy();
});
- it('has isNotFirstDayOfWeekStartOnThursday', () => {
+ test('has isNotFirstDayOfWeekStartOnThursday', () => {
const date = new Date(2018, 10, 23);
expect(
localTimeUtils.isNotFirstDayOfWeekStartOnThursday(date),
@@ -118,7 +118,7 @@ describe('utils', () => {
localTimeUtils.isNotFirstDayOfWeekStartOnThursday(date2),
).toBeFalsy();
});
- it('has isNotFirstDayOfWeekStartOnFriday', () => {
+ test('has isNotFirstDayOfWeekStartOnFriday', () => {
const date = new Date(2018, 10, 24);
expect(
localTimeUtils.isNotFirstDayOfWeekStartOnFriday(date),
@@ -128,7 +128,7 @@ describe('utils', () => {
localTimeUtils.isNotFirstDayOfWeekStartOnFriday(date2),
).toBeFalsy();
});
- it('has isNotFirstDayOfWeekStartOnSaturday', () => {
+ test('has isNotFirstDayOfWeekStartOnSaturday', () => {
const date = new Date(2018, 10, 25);
expect(
localTimeUtils.isNotFirstDayOfWeekStartOnSaturday(date),
diff --git a/superset-frontend/packages/superset-ui-core/test/utils/convertKeysToCamelCase.test.ts b/superset-frontend/packages/superset-ui-core/test/utils/convertKeysToCamelCase.test.ts
index 7b902f6cbe5..fe3fefc97c9 100644
--- a/superset-frontend/packages/superset-ui-core/test/utils/convertKeysToCamelCase.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/utils/convertKeysToCamelCase.test.ts
@@ -20,13 +20,13 @@
import { convertKeysToCamelCase } from '@superset-ui/core';
describe('convertKeysToCamelCase(object)', () => {
- it('returns undefined for undefined input', () => {
+ test('returns undefined for undefined input', () => {
expect(convertKeysToCamelCase(undefined)).toBeUndefined();
});
- it('returns null for null input', () => {
+ test('returns null for null input', () => {
expect(convertKeysToCamelCase(null)).toBeNull();
});
- it('returns a new object that has all keys in camelCase', () => {
+ test('returns a new object that has all keys in camelCase', () => {
const input = {
is_happy: true,
'is-angry': false,
@@ -38,7 +38,7 @@ describe('convertKeysToCamelCase(object)', () => {
isHungry: false,
});
});
- it('throws error if input is not a plain object', () => {
+ test('throws error if input is not a plain object', () => {
expect(() => {
convertKeysToCamelCase({});
}).not.toThrow();
diff --git a/superset-frontend/packages/superset-ui-core/test/utils/ensureIsArray.test.ts b/superset-frontend/packages/superset-ui-core/test/utils/ensureIsArray.test.ts
index 223782e6460..51353e9db4a 100644
--- a/superset-frontend/packages/superset-ui-core/test/utils/ensureIsArray.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/utils/ensureIsArray.test.ts
@@ -19,7 +19,7 @@
import { ensureIsArray } from '@superset-ui/core';
describe('ensureIsArray', () => {
- it('handle inputs correctly', () => {
+ test('handle inputs correctly', () => {
expect(ensureIsArray(undefined)).toEqual([]);
expect(ensureIsArray(null)).toEqual([]);
expect(ensureIsArray([])).toEqual([]);
diff --git a/superset-frontend/packages/superset-ui-core/test/utils/ensureIsInt.test.ts b/superset-frontend/packages/superset-ui-core/test/utils/ensureIsInt.test.ts
index 41f0df79d0e..0f3babb5222 100644
--- a/superset-frontend/packages/superset-ui-core/test/utils/ensureIsInt.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/utils/ensureIsInt.test.ts
@@ -19,7 +19,7 @@
import { ensureIsInt } from '@superset-ui/core';
describe('ensureIsInt', () => {
- it('handle inputs correctly', () => {
+ test('handle inputs correctly', () => {
expect(ensureIsInt(undefined, 0)).toEqual(0);
expect(ensureIsInt('abc', 1)).toEqual(1);
expect(ensureIsInt(undefined)).toEqual(NaN);
diff --git a/superset-frontend/packages/superset-ui-core/test/utils/isDefined.test.ts b/superset-frontend/packages/superset-ui-core/test/utils/isDefined.test.ts
index 756a4ec81ad..f4f38713d69 100644
--- a/superset-frontend/packages/superset-ui-core/test/utils/isDefined.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/utils/isDefined.test.ts
@@ -20,7 +20,7 @@
import { isDefined } from '@superset-ui/core';
describe('isDefined(value)', () => {
- it('returns true if value is not null and not undefined', () => {
+ test('returns true if value is not null and not undefined', () => {
expect(isDefined(0)).toBe(true);
expect(isDefined(1)).toBe(true);
expect(isDefined('')).toBe(true);
@@ -32,7 +32,7 @@ describe('isDefined(value)', () => {
expect(isDefined({ a: 1 })).toBe(true);
expect(isDefined([{}])).toBe(true);
});
- it('returns false otherwise', () => {
+ test('returns false otherwise', () => {
expect(isDefined(null)).toBe(false);
expect(isDefined(undefined)).toBe(false);
});
diff --git a/superset-frontend/packages/superset-ui-core/test/utils/isRequired.test.ts b/superset-frontend/packages/superset-ui-core/test/utils/isRequired.test.ts
index 99d7b78fdd8..cede68335aa 100644
--- a/superset-frontend/packages/superset-ui-core/test/utils/isRequired.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/utils/isRequired.test.ts
@@ -20,7 +20,7 @@
import { isRequired } from '@superset-ui/core';
describe('isRequired(field)', () => {
- it('should throw error with the given field in the message', () => {
+ test('should throw error with the given field in the message', () => {
expect(() => isRequired('myField')).toThrow(Error);
});
});
diff --git a/superset-frontend/packages/superset-ui-core/test/utils/makeSingleton.test.ts b/superset-frontend/packages/superset-ui-core/test/utils/makeSingleton.test.ts
index 0a74183326a..8b1bb96f8c9 100644
--- a/superset-frontend/packages/superset-ui-core/test/utils/makeSingleton.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/utils/makeSingleton.test.ts
@@ -36,23 +36,23 @@ describe('makeSingleton()', () => {
describe('makeSingleton(BaseClass)', () => {
const getInstance = makeSingleton(Dog);
- it('returns a function for getting singleton instance of a given base class', () => {
+ test('returns a function for getting singleton instance of a given base class', () => {
expect(typeof getInstance).toBe('function');
expect(getInstance()).toBeInstanceOf(Dog);
});
- it('returned function returns same instance across all calls', () => {
+ test('returned function returns same instance across all calls', () => {
expect(getInstance()).toBe(getInstance());
});
});
describe('makeSingleton(BaseClass, ...args)', () => {
const getInstance = makeSingleton(Dog, 'Doug');
- it('returns a function for getting singleton instance of a given base class constructed with the given arguments', () => {
+ test('returns a function for getting singleton instance of a given base class constructed with the given arguments', () => {
expect(typeof getInstance).toBe('function');
expect(getInstance()).toBeInstanceOf(Dog);
expect(getInstance().name).toBe('Doug');
});
- it('returned function returns same instance across all calls', () => {
+ test('returned function returns same instance across all calls', () => {
expect(getInstance()).toBe(getInstance());
});
});
diff --git a/superset-frontend/packages/superset-ui-core/test/utils/promiseTimeout.test.ts b/superset-frontend/packages/superset-ui-core/test/utils/promiseTimeout.test.ts
index ab1e28ae6d0..1a1ed0fe5b4 100644
--- a/superset-frontend/packages/superset-ui-core/test/utils/promiseTimeout.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/utils/promiseTimeout.test.ts
@@ -27,7 +27,7 @@ describe('promiseTimeout(func, delay)', () => {
jest.useRealTimers();
});
- it('resolves after delay', async () => {
+ test('resolves after delay', async () => {
const promise = promiseTimeout(() => 'abcd', 10);
jest.advanceTimersByTime(10);
const result = await promise;
@@ -35,7 +35,7 @@ describe('promiseTimeout(func, delay)', () => {
expect(result).toHaveLength(4);
});
- it('uses the timer', async () => {
+ test('uses the timer', async () => {
const promise = Promise.race([
promiseTimeout(() => 'abc', 10),
promiseTimeout(() => 'def', 20),
diff --git a/superset-frontend/packages/superset-ui-core/test/utils/random.test.ts b/superset-frontend/packages/superset-ui-core/test/utils/random.test.ts
index 4badf570214..d241c8b540f 100644
--- a/superset-frontend/packages/superset-ui-core/test/utils/random.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/utils/random.test.ts
@@ -20,11 +20,11 @@
import { seed, seedRandom } from '@superset-ui/core';
describe('random', () => {
- it('seeded random should return the same value', () => {
+ test('seeded random should return the same value', () => {
expect(seedRandom()).toEqual(0.7237953289342797);
});
- it('should allow update seed', () => {
+ test('should allow update seed', () => {
const a = seed('abc');
const b = seed('abc');
expect(a()).toEqual(b());
diff --git a/superset-frontend/packages/superset-ui-core/test/utils/removeDuplicates.test.ts b/superset-frontend/packages/superset-ui-core/test/utils/removeDuplicates.test.ts
index 439866771d6..06cba240fae 100644
--- a/superset-frontend/packages/superset-ui-core/test/utils/removeDuplicates.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/utils/removeDuplicates.test.ts
@@ -19,10 +19,10 @@
import { removeDuplicates } from '@superset-ui/core';
describe('removeDuplicates([...])', () => {
- it('should remove duplicates from a simple list', () => {
+ test('should remove duplicates from a simple list', () => {
expect(removeDuplicates([1, 2, 4, 1, 1, 5, 2])).toEqual([1, 2, 4, 5]);
});
- it('should remove duplicates by key getter', () => {
+ test('should remove duplicates by key getter', () => {
expect(removeDuplicates([{ a: 1 }, { a: 1 }, { b: 2 }], x => x.a)).toEqual([
{ a: 1 },
{ b: 2 },
diff --git a/superset-frontend/packages/superset-ui-core/test/validator/legacyValidateInteger.test.ts b/superset-frontend/packages/superset-ui-core/test/validator/legacyValidateInteger.test.ts
index 2e3388489b8..20db7ab724d 100644
--- a/superset-frontend/packages/superset-ui-core/test/validator/legacyValidateInteger.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/validator/legacyValidateInteger.test.ts
@@ -21,12 +21,12 @@ import { legacyValidateInteger } from '@superset-ui/core';
import './setup';
describe('legacyValidateInteger()', () => {
- it('returns the warning message if invalid', () => {
+ test('returns the warning message if invalid', () => {
expect(legacyValidateInteger(10.1)).toBeTruthy();
expect(legacyValidateInteger('abc')).toBeTruthy();
expect(legacyValidateInteger(Infinity)).toBeTruthy();
});
- it('returns false if the input is valid', () => {
+ test('returns false if the input is valid', () => {
// superset seems to operate on this incorrect behavior at the moment
expect(legacyValidateInteger(NaN)).toBeFalsy();
expect(legacyValidateInteger(undefined)).toBeFalsy();
diff --git a/superset-frontend/packages/superset-ui-core/test/validator/legacyValidateNumber.test.ts b/superset-frontend/packages/superset-ui-core/test/validator/legacyValidateNumber.test.ts
index 9613c48fd34..b25835b705f 100644
--- a/superset-frontend/packages/superset-ui-core/test/validator/legacyValidateNumber.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/validator/legacyValidateNumber.test.ts
@@ -21,10 +21,10 @@ import { legacyValidateNumber } from '@superset-ui/core';
import './setup';
describe('legacyValidateNumber()', () => {
- it('returns the warning message if invalid', () => {
+ test('returns the warning message if invalid', () => {
expect(legacyValidateNumber('abc')).toBeTruthy();
});
- it('returns false if the input is valid', () => {
+ test('returns false if the input is valid', () => {
// superset seems to operate on this incorrect behavior at the moment
expect(legacyValidateNumber(NaN)).toBeFalsy();
expect(legacyValidateNumber(Infinity)).toBeFalsy();
diff --git a/superset-frontend/packages/superset-ui-core/test/validator/validateInteger.test.ts b/superset-frontend/packages/superset-ui-core/test/validator/validateInteger.test.ts
index fd7cc1095b4..2e6ae5fe37a 100644
--- a/superset-frontend/packages/superset-ui-core/test/validator/validateInteger.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/validator/validateInteger.test.ts
@@ -21,7 +21,7 @@ import { validateInteger } from '@superset-ui/core';
import './setup';
describe('validateInteger()', () => {
- it('returns the warning message if invalid', () => {
+ test('returns the warning message if invalid', () => {
expect(validateInteger(10.1)).toBeTruthy();
expect(validateInteger(NaN)).toBeTruthy();
expect(validateInteger(Infinity)).toBeTruthy();
@@ -30,7 +30,7 @@ describe('validateInteger()', () => {
expect(validateInteger('abc')).toBeTruthy();
expect(validateInteger('')).toBeTruthy();
});
- it('returns false if the input is valid', () => {
+ test('returns false if the input is valid', () => {
expect(validateInteger(0)).toBeFalsy();
expect(validateInteger(10)).toBeFalsy();
expect(validateInteger('10')).toBeFalsy();
diff --git a/superset-frontend/packages/superset-ui-core/test/validator/validateMapboxStylesUrl.test.ts b/superset-frontend/packages/superset-ui-core/test/validator/validateMapboxStylesUrl.test.ts
index 8572a9a0912..4fc7de1a424 100644
--- a/superset-frontend/packages/superset-ui-core/test/validator/validateMapboxStylesUrl.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/validator/validateMapboxStylesUrl.test.ts
@@ -20,7 +20,7 @@ import { validateMapboxStylesUrl } from '@superset-ui/core';
import './setup';
describe('validateMapboxStylesUrl', () => {
- it('should validate mapbox style URLs', () => {
+ test('should validate mapbox style URLs', () => {
expect(
validateMapboxStylesUrl('mapbox://styles/mapbox/streets-v9'),
).toEqual(false);
@@ -43,7 +43,7 @@ describe('validateMapboxStylesUrl', () => {
'https://superset.apache.org/',
'mapbox://tileset/mapbox/streets-v9',
].forEach(value => {
- it(`should not validate ${value}`, () => {
+ test(`should not validate ${value}`, () => {
expect(validateMapboxStylesUrl(value)).toEqual(
'is expected to be a Mapbox/OSM URL (eg. mapbox://styles/...) or a tile server URL (eg. tile://http...)',
);
diff --git a/superset-frontend/packages/superset-ui-core/test/validator/validateNonEmpty.test.ts b/superset-frontend/packages/superset-ui-core/test/validator/validateNonEmpty.test.ts
index 384c2b57c75..a66e1596ece 100644
--- a/superset-frontend/packages/superset-ui-core/test/validator/validateNonEmpty.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/validator/validateNonEmpty.test.ts
@@ -21,13 +21,13 @@ import { validateNonEmpty } from '@superset-ui/core';
import './setup';
describe('validateNonEmpty()', () => {
- it('returns the warning message if invalid', () => {
+ test('returns the warning message if invalid', () => {
expect(validateNonEmpty([])).toBeTruthy();
expect(validateNonEmpty(undefined)).toBeTruthy();
expect(validateNonEmpty(null)).toBeTruthy();
expect(validateNonEmpty('')).toBeTruthy();
});
- it('returns false if the input is valid', () => {
+ test('returns false if the input is valid', () => {
expect(validateNonEmpty(0)).toBeFalsy();
expect(validateNonEmpty(10)).toBeFalsy();
expect(validateNonEmpty('abc')).toBeFalsy();
diff --git a/superset-frontend/packages/superset-ui-core/test/validator/validateNumber.test.ts b/superset-frontend/packages/superset-ui-core/test/validator/validateNumber.test.ts
index 0c785d72007..3d7679f78b4 100644
--- a/superset-frontend/packages/superset-ui-core/test/validator/validateNumber.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/validator/validateNumber.test.ts
@@ -21,7 +21,7 @@ import { validateNumber } from '@superset-ui/core';
import './setup';
describe('validateNumber()', () => {
- it('returns the warning message if invalid', () => {
+ test('returns the warning message if invalid', () => {
expect(validateNumber(NaN)).toBeTruthy();
expect(validateNumber(Infinity)).toBeTruthy();
expect(validateNumber(undefined)).toBeTruthy();
@@ -29,7 +29,7 @@ describe('validateNumber()', () => {
expect(validateNumber('abc')).toBeTruthy();
expect(validateNumber('')).toBeTruthy();
});
- it('returns false if the input is valid', () => {
+ test('returns false if the input is valid', () => {
expect(validateNumber(0)).toBeFalsy();
expect(validateNumber(10.1)).toBeFalsy();
expect(validateNumber(10)).toBeFalsy();
diff --git a/superset-frontend/packages/superset-ui-core/test/validator/validateTimeComparisonRangeValues.test.ts b/superset-frontend/packages/superset-ui-core/test/validator/validateTimeComparisonRangeValues.test.ts
index ac0d5a481b6..1798476fa1c 100644
--- a/superset-frontend/packages/superset-ui-core/test/validator/validateTimeComparisonRangeValues.test.ts
+++ b/superset-frontend/packages/superset-ui-core/test/validator/validateTimeComparisonRangeValues.test.ts
@@ -24,7 +24,7 @@ import {
import './setup';
describe('validateTimeComparisonRangeValues()', () => {
- it('returns the warning message if invalid', () => {
+ test('returns the warning message if invalid', () => {
expect(
validateTimeComparisonRangeValues(ComparisonTimeRangeType.Custom, []),
).toBeTruthy();
@@ -38,7 +38,7 @@ describe('validateTimeComparisonRangeValues()', () => {
validateTimeComparisonRangeValues(ComparisonTimeRangeType.Custom, null),
).toBeTruthy();
});
- it('returns empty array if the input is valid', () => {
+ test('returns empty array if the input is valid', () => {
expect(
validateTimeComparisonRangeValues(ComparisonTimeRangeType.Year, []),
).toEqual([]);
diff --git a/superset-frontend/packages/superset-ui-switchboard/src/switchboard.test.ts b/superset-frontend/packages/superset-ui-switchboard/src/switchboard.test.ts
index 915fe0cc423..5bfe77903ff 100644
--- a/superset-frontend/packages/superset-ui-switchboard/src/switchboard.test.ts
+++ b/superset-frontend/packages/superset-ui-switchboard/src/switchboard.test.ts
@@ -122,14 +122,14 @@ describe('comms', () => {
console.error = originalConsoleError;
});
- it('constructs with defaults', () => {
+ test('constructs with defaults', () => {
const sb = new Switchboard({ port: new MessageChannel().port1 });
expect(sb).not.toBeNull();
expect(sb).toHaveProperty('name');
expect(sb).toHaveProperty('debugMode');
});
- it('singleton', async () => {
+ test('singleton', async () => {
SingletonSwitchboard.start();
expect(console.error).toHaveBeenCalledWith(
'[]',
@@ -154,7 +154,7 @@ describe('comms', () => {
});
describe('emit', () => {
- it('triggers the method', async () => {
+ test('triggers the method', async () => {
const channel = new MessageChannel();
const ours = new Switchboard({ port: channel.port1, name: 'ours' });
const theirs = new Switchboard({ port: channel.port2, name: 'theirs' });
@@ -168,7 +168,7 @@ describe('comms', () => {
expect(handler).toHaveBeenCalledWith(42);
});
- it('handles a missing method', async () => {
+ test('handles a missing method', async () => {
const channel = new MessageChannel();
const ours = new Switchboard({ port: channel.port1, name: 'ours' });
const theirs = new Switchboard({ port: channel.port2, name: 'theirs' });
@@ -181,7 +181,7 @@ describe('comms', () => {
});
describe('get', () => {
- it('returns the value', async () => {
+ test('returns the value', async () => {
const channel = new MessageChannel();
const ours = new Switchboard({ port: channel.port1, name: 'ours' });
const theirs = new Switchboard({ port: channel.port2, name: 'theirs' });
@@ -195,7 +195,7 @@ describe('comms', () => {
expect(value).toEqual(43);
});
- it('removes the listener after', async () => {
+ test('removes the listener after', async () => {
const channel = new MessageChannel();
const ours = new Switchboard({ port: channel.port1, name: 'ours' });
const theirs = new Switchboard({ port: channel.port2, name: 'theirs' });
@@ -218,7 +218,7 @@ describe('comms', () => {
);
});
- it('can handle one way concurrency', async () => {
+ test('can handle one way concurrency', async () => {
const channel = new MessageChannel();
const ours = new Switchboard({ port: channel.port1, name: 'ours' });
const theirs = new Switchboard({ port: channel.port2, name: 'theirs' });
@@ -238,7 +238,7 @@ describe('comms', () => {
expect(value2).toEqual(420);
});
- it('can handle two way concurrency', async () => {
+ test('can handle two way concurrency', async () => {
const channel = new MessageChannel();
const ours = new Switchboard({ port: channel.port1, name: 'ours' });
const theirs = new Switchboard({ port: channel.port2, name: 'theirs' });
@@ -258,7 +258,7 @@ describe('comms', () => {
expect(value2).toEqual(420);
});
- it('handles when the method is not defined', async () => {
+ test('handles when the method is not defined', async () => {
const channel = new MessageChannel();
const ours = new Switchboard({ port: channel.port1, name: 'ours' });
const theirs = new Switchboard({ port: channel.port2, name: 'theirs' });
@@ -268,7 +268,7 @@ describe('comms', () => {
);
});
- it('handles when the method throws', async () => {
+ test('handles when the method throws', async () => {
const channel = new MessageChannel();
const ours = new Switchboard({ port: channel.port1, name: 'ours' });
const theirs = new Switchboard({ port: channel.port2, name: 'theirs' });
@@ -283,7 +283,7 @@ describe('comms', () => {
);
});
- it('handles receiving an unexpected non-reply, non-error response', async () => {
+ test('handles receiving an unexpected non-reply, non-error response', async () => {
const { port1, port2 } = new MessageChannel();
const ours = new Switchboard({ port: port1, name: 'ours' });
// This test is required for 100% coverage. But there's no way to set up these conditions
@@ -300,7 +300,7 @@ describe('comms', () => {
});
});
- it('logs in debug mode', async () => {
+ test('logs in debug mode', async () => {
const { port1, port2 } = new MessageChannel();
const ours = new Switchboard({
port: port1,
@@ -319,7 +319,7 @@ describe('comms', () => {
expect((console.debug as any).mock.calls[0][0]).toBe('[theirs]');
});
- it('does not log outside debug mode', async () => {
+ test('does not log outside debug mode', async () => {
const { port1, port2 } = new MessageChannel();
const ours = new Switchboard({
port: port1,
diff --git a/superset-frontend/playwright/tests/experimental/dataset/dataset-list.spec.ts b/superset-frontend/playwright/tests/experimental/dataset/dataset-list.spec.ts
index 5afa350e58c..04dbe376448 100644
--- a/superset-frontend/playwright/tests/experimental/dataset/dataset-list.spec.ts
+++ b/superset-frontend/playwright/tests/experimental/dataset/dataset-list.spec.ts
@@ -634,7 +634,7 @@ test('should edit column date format via modal', async ({
// Verify via API
const updatedRes = await apiGetDataset(page, datasetId);
- const columns = (await updatedRes.json()).result.columns;
+ const { columns } = (await updatedRes.json()).result;
const dsColumn = columns.find(
(c: { column_name: string }) => c.column_name === 'ds',
);
@@ -677,6 +677,6 @@ test('should edit dataset description via modal', async ({
// Verify via API
const updatedRes = await apiGetDataset(page, datasetId);
- const result = (await updatedRes.json()).result;
+ const { result } = await updatedRes.json();
expect(result.description).toBe(description);
});
diff --git a/superset-frontend/plugins/legacy-plugin-chart-calendar/test/utils.test.ts b/superset-frontend/plugins/legacy-plugin-chart-calendar/test/utils.test.ts
index a7543d76424..6f414b62841 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-calendar/test/utils.test.ts
+++ b/superset-frontend/plugins/legacy-plugin-chart-calendar/test/utils.test.ts
@@ -20,7 +20,7 @@
import { getFormattedUTCTime, convertUTCTimestampToLocal } from '../src/utils';
describe('getFormattedUTCTime', () => {
- it('formats local timestamp for display as UTC date', () => {
+ test('formats local timestamp for display as UTC date', () => {
const utcTimestamp = 1420070400000; // 2015-01-01 00:00:00 UTC
const localTimestamp = convertUTCTimestampToLocal(utcTimestamp);
const formattedTime = getFormattedUTCTime(
@@ -33,7 +33,7 @@ describe('getFormattedUTCTime', () => {
});
describe('convertUTCTimestampToLocal', () => {
- it('adjusts timestamp so local Date shows UTC date', () => {
+ test('adjusts timestamp so local Date shows UTC date', () => {
const utcTimestamp = 1704067200000;
const adjustedTimestamp = convertUTCTimestampToLocal(utcTimestamp);
const adjustedDate = new Date(adjustedTimestamp);
@@ -43,7 +43,7 @@ describe('convertUTCTimestampToLocal', () => {
expect(adjustedDate.getDate()).toEqual(1);
});
- it('handles month boundaries', () => {
+ test('handles month boundaries', () => {
const utcTimestamp = 1706745600000;
const adjustedDate = new Date(convertUTCTimestampToLocal(utcTimestamp));
@@ -52,7 +52,7 @@ describe('convertUTCTimestampToLocal', () => {
expect(adjustedDate.getDate()).toEqual(1);
});
- it('handles year boundaries', () => {
+ test('handles year boundaries', () => {
const utcTimestamp = 1735689600000;
const adjustedDate = new Date(convertUTCTimestampToLocal(utcTimestamp));
@@ -61,7 +61,7 @@ describe('convertUTCTimestampToLocal', () => {
expect(adjustedDate.getDate()).toEqual(1);
});
- it('adds timezone offset to timestamp', () => {
+ test('adds timezone offset to timestamp', () => {
const utcTimestamp = 1704067200000;
const adjustedTimestamp = convertUTCTimestampToLocal(utcTimestamp);
const expectedOffset =
@@ -72,7 +72,7 @@ describe('convertUTCTimestampToLocal', () => {
});
describe('integration', () => {
- it('fixes timezone bug for CalHeatMap', () => {
+ test('fixes timezone bug for CalHeatMap', () => {
const febFirst2024UTC = 1706745600000;
const adjustedDate = new Date(convertUTCTimestampToLocal(febFirst2024UTC));
@@ -80,7 +80,7 @@ describe('integration', () => {
expect(adjustedDate.getDate()).toEqual(1);
});
- it('both functions work together to display dates correctly', () => {
+ test('both functions work together to display dates correctly', () => {
const utcTimestamp = 1704067200000;
// convertUTCTimestampToLocal adjusts UTC for Cal-Heatmap (which interprets as local)
diff --git a/superset-frontend/plugins/legacy-plugin-chart-country-map/test/CountryMap.test.tsx b/superset-frontend/plugins/legacy-plugin-chart-country-map/test/CountryMap.test.tsx
index 97628a5fb68..dbe912618cf 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-country-map/test/CountryMap.test.tsx
+++ b/superset-frontend/plugins/legacy-plugin-chart-country-map/test/CountryMap.test.tsx
@@ -79,7 +79,7 @@ describe('CountryMap (legacy d3)', () => {
jest.clearAllMocks();
});
- it('renders a map after d3.json loads data', async () => {
+ test('renders a map after d3.json loads data', async () => {
d3Any.json.mockImplementation((_url: string, cb: D3JsonCallback) =>
cb(null, mockMapData),
);
@@ -102,7 +102,7 @@ describe('CountryMap (legacy d3)', () => {
expect(region).not.toBeNull();
});
- it('shows tooltip on mouseenter/mousemove/mouseout', async () => {
+ test('shows tooltip on mouseenter/mousemove/mouseout', async () => {
d3Any.json.mockImplementation((_url: string, cb: D3JsonCallback) =>
cb(null, mockMapData),
);
@@ -131,7 +131,7 @@ describe('CountryMap (legacy d3)', () => {
expect(popup!).toHaveStyle({ display: 'none' });
});
- it('shows tooltip on mouseenter/mousemove/mouseout', async () => {
+ test('shows tooltip on mouseenter/mousemove/mouseout', async () => {
d3Any.json.mockImplementation((_url: string, cb: D3JsonCallback) =>
cb(null, mockMapData),
);
diff --git a/superset-frontend/plugins/legacy-plugin-chart-map-box/test/utils/roundDecimal.test.ts b/superset-frontend/plugins/legacy-plugin-chart-map-box/test/utils/roundDecimal.test.ts
index 384eeb9412c..a7fdda63a8a 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-map-box/test/utils/roundDecimal.test.ts
+++ b/superset-frontend/plugins/legacy-plugin-chart-map-box/test/utils/roundDecimal.test.ts
@@ -20,7 +20,7 @@
import roundDecimal from '../../src/utils/roundDecimal';
describe('roundDecimal', () => {
- it('rounding method to limit the number of decimal digits', () => {
+ test('rounding method to limit the number of decimal digits', () => {
expect(roundDecimal(1.139, 2)).toBe(1.14);
expect(roundDecimal(1.13929, 3)).toBe(1.139);
expect(roundDecimal(1.13929)).toBe(1);
diff --git a/superset-frontend/plugins/legacy-plugin-chart-partition/test/OptionDescription.test.tsx b/superset-frontend/plugins/legacy-plugin-chart-partition/test/OptionDescription.test.tsx
index b878dc7b330..6422ff50c56 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-partition/test/OptionDescription.test.tsx
+++ b/superset-frontend/plugins/legacy-plugin-chart-partition/test/OptionDescription.test.tsx
@@ -42,7 +42,7 @@ describe('OptionDescription', () => {
render();
});
- it('renders an InfoTooltip', () => {
+ test('renders an InfoTooltip', () => {
const tooltipTrigger = screen.getByLabelText('Show info tooltip');
expect(tooltipTrigger).toBeInTheDocument();
@@ -55,7 +55,7 @@ describe('OptionDescription', () => {
expect(tooltip).toHaveTextContent('Description for some option');
});
- it('renders a span with the label', () => {
+ test('renders a span with the label', () => {
expect(
screen.getByText('Some option', { selector: 'span' }),
).toBeInTheDocument();
diff --git a/superset-frontend/plugins/legacy-plugin-chart-world-map/test/WorldMap.test.ts b/superset-frontend/plugins/legacy-plugin-chart-world-map/test/WorldMap.test.ts
index 8ae4109ea41..096c558bc63 100644
--- a/superset-frontend/plugins/legacy-plugin-chart-world-map/test/WorldMap.test.ts
+++ b/superset-frontend/plugins/legacy-plugin-chart-world-map/test/WorldMap.test.ts
@@ -77,8 +77,8 @@ const mockSvg = {
style: jest.fn().mockReturnThis(),
};
-jest.mock('datamaps/dist/datamaps.all.min', () => {
- return jest.fn().mockImplementation(config => {
+jest.mock('datamaps/dist/datamaps.all.min', () =>
+ jest.fn().mockImplementation(config => {
// Call the done callback immediately to simulate Datamap initialization
if (config.done) {
config.done({
@@ -90,8 +90,8 @@ jest.mock('datamaps/dist/datamaps.all.min', () => {
updateChoropleth: mockUpdateChoropleth,
svg: mockSvg,
};
- });
-});
+ }),
+);
let container: HTMLElement;
const formatter = getNumberFormatter();
diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/Multi/Multi.test.tsx b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/Multi/Multi.test.tsx
index 91104ba7502..0930b58f011 100644
--- a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/Multi/Multi.test.tsx
+++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/Multi/Multi.test.tsx
@@ -137,7 +137,7 @@ describe('DeckMulti Autozoom Functionality', () => {
});
});
- it('should NOT apply autozoom when autozoom is false', () => {
+ test('should NOT apply autozoom when autozoom is false', () => {
const fitViewportSpy = jest.spyOn(fitViewportModule, 'default');
const props = {
@@ -156,7 +156,7 @@ describe('DeckMulti Autozoom Functionality', () => {
fitViewportSpy.mockRestore();
});
- it('should apply autozoom when autozoom is true', () => {
+ test('should apply autozoom when autozoom is true', () => {
const fitViewportSpy = jest.spyOn(fitViewportModule, 'default');
fitViewportSpy.mockReturnValue({
longitude: -122.4,
@@ -191,7 +191,7 @@ describe('DeckMulti Autozoom Functionality', () => {
fitViewportSpy.mockRestore();
});
- it('should use adjusted viewport when autozoom is enabled', async () => {
+ test('should use adjusted viewport when autozoom is enabled', async () => {
const fitViewportSpy = jest.spyOn(fitViewportModule, 'default');
const adjustedViewport = {
longitude: -122.4,
@@ -224,7 +224,7 @@ describe('DeckMulti Autozoom Functionality', () => {
fitViewportSpy.mockRestore();
});
- it('should set zoom to 0 when calculated zoom is negative', async () => {
+ test('should set zoom to 0 when calculated zoom is negative', async () => {
const fitViewportSpy = jest.spyOn(fitViewportModule, 'default');
fitViewportSpy.mockReturnValue({
longitude: 0,
@@ -255,7 +255,7 @@ describe('DeckMulti Autozoom Functionality', () => {
fitViewportSpy.mockRestore();
});
- it('should handle empty features gracefully when autozoom is enabled', () => {
+ test('should handle empty features gracefully when autozoom is enabled', () => {
const fitViewportSpy = jest.spyOn(fitViewportModule, 'default');
const props = {
@@ -292,7 +292,7 @@ describe('DeckMulti Autozoom Functionality', () => {
fitViewportSpy.mockRestore();
});
- it('should collect points from all layer types when autozoom is enabled', () => {
+ test('should collect points from all layer types when autozoom is enabled', () => {
const fitViewportSpy = jest.spyOn(fitViewportModule, 'default');
fitViewportSpy.mockReturnValue({
longitude: 0,
@@ -345,7 +345,7 @@ describe('DeckMulti Autozoom Functionality', () => {
fitViewportSpy.mockRestore();
});
- it('should use original viewport when autozoom is disabled', async () => {
+ test('should use original viewport when autozoom is disabled', async () => {
const fitViewportSpy = jest.spyOn(fitViewportModule, 'default');
const originalViewport = { longitude: -100, latitude: 40, zoom: 5 };
@@ -378,7 +378,7 @@ describe('DeckMulti Autozoom Functionality', () => {
fitViewportSpy.mockRestore();
});
- it('should apply autozoom when autozoom is undefined (backward compatibility)', () => {
+ test('should apply autozoom when autozoom is undefined (backward compatibility)', () => {
const fitViewportSpy = jest.spyOn(fitViewportModule, 'default');
fitViewportSpy.mockReturnValue({
longitude: -122.4,
@@ -413,7 +413,7 @@ describe('DeckMulti Autozoom Functionality', () => {
fitViewportSpy.mockRestore();
});
- it('should use adjusted viewport when autozoom is undefined', async () => {
+ test('should use adjusted viewport when autozoom is undefined', async () => {
const fitViewportSpy = jest.spyOn(fitViewportModule, 'default');
const adjustedViewport = {
longitude: -122.4,
@@ -460,7 +460,7 @@ describe('DeckMulti Component Rendering', () => {
});
});
- it('should render DeckGLContainer', async () => {
+ test('should render DeckGLContainer', async () => {
renderWithProviders();
await waitFor(() => {
@@ -468,7 +468,7 @@ describe('DeckMulti Component Rendering', () => {
});
});
- it('should pass correct props to DeckGLContainer', async () => {
+ test('should pass correct props to DeckGLContainer', async () => {
renderWithProviders();
await waitFor(() => {
@@ -485,7 +485,7 @@ describe('DeckMulti Component Rendering', () => {
});
});
- it('should include dashboardId in child slice requests when present', async () => {
+ test('should include dashboardId in child slice requests when present', async () => {
const props = {
...baseMockProps,
formData: {
@@ -502,7 +502,7 @@ describe('DeckMulti Component Rendering', () => {
});
// Check that all requests include the dashboardId
- const calls = (SupersetClient.get as jest.Mock).mock.calls;
+ const { calls } = (SupersetClient.get as jest.Mock).mock;
calls.forEach(call => {
const url = call[0].endpoint;
const urlParams = new URLSearchParams(url.split('?')[1]);
@@ -512,7 +512,7 @@ describe('DeckMulti Component Rendering', () => {
});
});
- it('should not include dashboardId when not present', async () => {
+ test('should not include dashboardId when not present', async () => {
const props = {
...baseMockProps,
formData: {
@@ -529,7 +529,7 @@ describe('DeckMulti Component Rendering', () => {
});
// Check that requests don't include dashboardId
- const calls = (SupersetClient.get as jest.Mock).mock.calls;
+ const { calls } = (SupersetClient.get as jest.Mock).mock;
calls.forEach(call => {
const url = call[0].endpoint;
const formData = JSON.parse(
@@ -539,7 +539,7 @@ describe('DeckMulti Component Rendering', () => {
});
});
- it('should preserve dashboardId through filter updates', async () => {
+ test('should preserve dashboardId through filter updates', async () => {
const props = {
...baseMockProps,
formData: {
@@ -557,7 +557,7 @@ describe('DeckMulti Component Rendering', () => {
});
// Verify dashboardId is preserved with filters
- const calls = (SupersetClient.get as jest.Mock).mock.calls;
+ const { calls } = (SupersetClient.get as jest.Mock).mock;
calls.forEach(call => {
const url = call[0].endpoint;
const formData = JSON.parse(
@@ -568,7 +568,7 @@ describe('DeckMulti Component Rendering', () => {
});
});
- it('should handle viewport changes', async () => {
+ test('should handle viewport changes', async () => {
const { rerender } = renderWithProviders();
// Wait for initial render
diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Contour/getSafeCellSize.test.ts b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Contour/getSafeCellSize.test.ts
index cb29ae81621..e1185ca5f0f 100644
--- a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Contour/getSafeCellSize.test.ts
+++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Contour/getSafeCellSize.test.ts
@@ -23,19 +23,19 @@ import {
} from './getSafeCellSize';
describe('getSafeCellSize', () => {
- it('defaults to 200 when value is not finite', () => {
+ test('defaults to 200 when value is not finite', () => {
expect(getSafeCellSize({ cellSize: 'nope' })).toBe(200);
});
- it('clamps below minimum', () => {
+ test('clamps below minimum', () => {
expect(getSafeCellSize({ cellSize: 1 })).toBe(MIN_CELL_SIZE);
});
- it('clamps above maximum', () => {
+ test('clamps above maximum', () => {
expect(getSafeCellSize({ cellSize: 999999 })).toBe(MAX_CELL_SIZE);
});
- it('auto-scales when estimated grid is too large', () => {
+ test('auto-scales when estimated grid is too large', () => {
const size = getSafeCellSize({
cellSize: 1,
viewport: { width: 11000, height: 11000 },
@@ -44,7 +44,7 @@ describe('getSafeCellSize', () => {
expect(size).toBeGreaterThan(MIN_CELL_SIZE);
});
- it('never exceeds MAX_CELL_SIZE', () => {
+ test('never exceeds MAX_CELL_SIZE', () => {
const size = getSafeCellSize({
cellSize: 1,
viewport: { width: 100000, height: 100000 },
@@ -53,7 +53,7 @@ describe('getSafeCellSize', () => {
expect(size).toBeLessThanOrEqual(MAX_CELL_SIZE);
});
- it('calls onAutoAdjust when scaling happens', () => {
+ test('calls onAutoAdjust when scaling happens', () => {
const spy = jest.fn();
getSafeCellSize({
diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Path/Path.test.tsx b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Path/Path.test.tsx
index 96f7ca4e760..b297c425843 100644
--- a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Path/Path.test.tsx
+++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Path/Path.test.tsx
@@ -18,6 +18,7 @@
*/
// eslint-disable-next-line import/no-extraneous-dependencies
import '@testing-library/jest-dom';
+import { getLayer, getPoints, getHighlightLayer } from './Path';
jest.mock('../../DeckGLContainer', () => ({
DeckGLContainerStyledWrapper: ({ children }: any) => (
@@ -30,8 +31,6 @@ jest.mock('../../factory', () => ({
GetLayerType: {},
}));
-import { getLayer, getPoints, getHighlightLayer } from './Path';
-
const mockFormData = {
datasource: 'test_datasource',
viz_type: 'deck_path',
diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Polygon/Polygon.test.tsx b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Polygon/Polygon.test.tsx
index a4de1e8f817..9e8cf8f82f0 100644
--- a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Polygon/Polygon.test.tsx
+++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/Polygon/Polygon.test.tsx
@@ -122,7 +122,7 @@ describe('DeckGLPolygon bucket generation logic', () => {
const renderWithTheme = (component: React.ReactElement) =>
render({component});
- it('should use getBuckets for linear_palette color scheme', () => {
+ test('should use getBuckets for linear_palette color scheme', () => {
const propsWithLinearPalette = {
...mockProps,
formData: {
@@ -138,7 +138,7 @@ describe('DeckGLPolygon bucket generation logic', () => {
expect(mockGetColorBreakpointsBuckets).not.toHaveBeenCalled();
});
- it('should use getBuckets for fixed_color color scheme', () => {
+ test('should use getBuckets for fixed_color color scheme', () => {
const propsWithFixedColor = {
...mockProps,
formData: {
@@ -154,7 +154,7 @@ describe('DeckGLPolygon bucket generation logic', () => {
expect(mockGetColorBreakpointsBuckets).not.toHaveBeenCalled();
});
- it('should use getColorBreakpointsBuckets for color_breakpoints scheme', () => {
+ test('should use getColorBreakpointsBuckets for color_breakpoints scheme', () => {
const propsWithBreakpoints = {
...mockProps,
formData: {
@@ -187,7 +187,7 @@ describe('DeckGLPolygon bucket generation logic', () => {
expect(mockGetBuckets).not.toHaveBeenCalled();
});
- it('should use getBuckets when color_scheme_type is undefined (backward compatibility)', () => {
+ test('should use getBuckets when color_scheme_type is undefined (backward compatibility)', () => {
const propsWithUndefinedScheme = {
...mockProps,
formData: {
@@ -203,7 +203,7 @@ describe('DeckGLPolygon bucket generation logic', () => {
expect(mockGetColorBreakpointsBuckets).not.toHaveBeenCalled();
});
- it('should use getBuckets for unsupported color schemes (categorical_palette)', () => {
+ test('should use getBuckets for unsupported color schemes (categorical_palette)', () => {
const propsWithUnsupportedScheme = {
...mockProps,
formData: {
@@ -230,7 +230,7 @@ describe('DeckGLPolygon Error Handling and Edge Cases', () => {
const renderWithTheme = (component: React.ReactElement) =>
render({component});
- it('handles empty features data gracefully', () => {
+ test('handles empty features data gracefully', () => {
const propsWithEmptyData = {
...mockProps,
payload: {
@@ -249,7 +249,7 @@ describe('DeckGLPolygon Error Handling and Edge Cases', () => {
expect(mockGetColorBreakpointsBuckets).not.toHaveBeenCalled();
});
- it('handles missing color_breakpoints for color_breakpoints scheme', () => {
+ test('handles missing color_breakpoints for color_breakpoints scheme', () => {
const propsWithMissingBreakpoints = {
...mockProps,
formData: {
@@ -266,7 +266,7 @@ describe('DeckGLPolygon Error Handling and Edge Cases', () => {
expect(mockGetBuckets).not.toHaveBeenCalled();
});
- it('handles null legend_position correctly', () => {
+ test('handles null legend_position correctly', () => {
const propsWithNullLegendPosition = {
...mockProps,
formData: {
@@ -294,7 +294,7 @@ describe('DeckGLPolygon Legend Integration', () => {
const renderWithTheme = (component: React.ReactElement) =>
render({component});
- it('renders legend with non-empty categories when metric and linear_palette are defined', () => {
+ test('renders legend with non-empty categories when metric and linear_palette are defined', () => {
const { container } = renderWithTheme();
// Verify the component renders and calls the correct bucket function
@@ -309,7 +309,7 @@ describe('DeckGLPolygon Legend Integration', () => {
expect(Object.keys(categoriesData)).toHaveLength(2);
});
- it('does not render legend when metric is null', () => {
+ test('does not render legend when metric is null', () => {
const propsWithoutMetric = {
...mockProps,
formData: {
@@ -326,7 +326,7 @@ describe('DeckGLPolygon Legend Integration', () => {
});
describe('getPoints utility', () => {
- it('extracts points from polygon data', () => {
+ test('extracts points from polygon data', () => {
const data = [
{
polygon: [
diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/common.test.ts b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/common.test.ts
index d598f2f48d2..1dda87eb046 100644
--- a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/common.test.ts
+++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/common.test.ts
@@ -35,61 +35,61 @@ const partialformData: Partial = {
};
describe('getAggFunc', () => {
- it('returns correct function for sum', () => {
+ test('returns correct function for sum', () => {
const aggFunc = getAggFunc('sum');
const result = aggFunc([1, 2, 3, 4]);
expect(result).toBe(10);
});
- it('returns correct function for min', () => {
+ test('returns correct function for min', () => {
const aggFunc = getAggFunc('min');
const result = aggFunc([1, 2, 3, 4]);
expect(result).toBe(1);
});
- it('returns correct function for max', () => {
+ test('returns correct function for max', () => {
const aggFunc = getAggFunc('max');
const result = aggFunc([1, 2, 3, 4]);
expect(result).toBe(4);
});
- it('returns correct function for mean', () => {
+ test('returns correct function for mean', () => {
const aggFunc = getAggFunc('mean');
const result = aggFunc([1, 2, 3, 4]);
expect(result).toBe(2.5);
});
- it('returns correct function for median', () => {
+ test('returns correct function for median', () => {
const aggFunc = getAggFunc('median');
const result = aggFunc([1, 2, 3, 4, 5]);
expect(result).toBe(3);
});
- it('returns correct function for variance', () => {
+ test('returns correct function for variance', () => {
const aggFunc = getAggFunc('variance');
const result = aggFunc([1, 2, 3, 4]);
expect(result).toBeCloseTo(1.6666666666666667);
});
- it('returns correct function for deviation', () => {
+ test('returns correct function for deviation', () => {
const aggFunc = getAggFunc('deviation');
const result = aggFunc([1, 2, 3, 4]);
expect(result).toBeCloseTo(1.29099, 5);
});
- it('returns correct function for count', () => {
+ test('returns correct function for count', () => {
const aggFunc = getAggFunc('count');
const result = aggFunc([1, 2, 3, 4]);
expect(result).toBe(4);
});
- it('returns correct function for p95 (percentiles)', () => {
+ test('returns correct function for p95 (percentiles)', () => {
const aggFunc = getAggFunc('p95');
const result = aggFunc([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
expect(result).toBeCloseTo(9.55, 5);
});
- it('throws an error for unsupported aggregation type', () => {
+ test('throws an error for unsupported aggregation type', () => {
expect(() => getAggFunc('unsupported')).toThrow(
'Unsupported aggregation type: unsupported',
);
@@ -103,7 +103,7 @@ describe('commonLayerProps', () => {
);
const mockOnSelect = jest.fn();
- it('returns correct props when js_tooltip is provided', () => {
+ test('returns correct props when js_tooltip is provided', () => {
const formData = {
...partialformData,
js_tooltip: 'tooltip => tooltip.content',
@@ -117,7 +117,7 @@ describe('commonLayerProps', () => {
expect(props.onHover).toBeDefined();
});
- it('calls onHover and sets tooltip', () => {
+ test('calls onHover and sets tooltip', () => {
const formData = { ...partialformData, js_tooltip: null } as QueryFormData;
const props = commonLayerProps({
formData,
@@ -134,7 +134,7 @@ describe('commonLayerProps', () => {
});
});
- it('calls onSelect when table_filter is enabled', () => {
+ test('calls onSelect when table_filter is enabled', () => {
const formData = {
...partialformData,
table_filter: true,
@@ -175,26 +175,26 @@ describe('getColorForBreakpoints', () => {
{ minValue: 21, maxValue: 30, color: { r: 0, g: 0, b: 255, a: 100 } },
];
- it('returns correct breakpoint index for value in range', () => {
+ test('returns correct breakpoint index for value in range', () => {
const aggFunc = (arr: number[]) => arr[0];
expect(getColorForBreakpoints(aggFunc, [5], colorBreakpoints)).toBe(1);
expect(getColorForBreakpoints(aggFunc, [15], colorBreakpoints)).toBe(2);
expect(getColorForBreakpoints(aggFunc, [25], colorBreakpoints)).toBe(3);
});
- it('returns 0 if value is not in any breakpoint', () => {
+ test('returns 0 if value is not in any breakpoint', () => {
const aggFunc = () => 100;
expect(getColorForBreakpoints(aggFunc, [100], colorBreakpoints)).toBe(0);
});
- it('returns undefined if aggFunc returns undefined', () => {
+ test('returns undefined if aggFunc returns undefined', () => {
const aggFunc = () => undefined;
expect(
getColorForBreakpoints(aggFunc, [5], colorBreakpoints),
).toBeUndefined();
});
- it('returns undefined if aggFunc returns array', () => {
+ test('returns undefined if aggFunc returns array', () => {
const aggFunc = () => [1, 2];
expect(
getColorForBreakpoints(aggFunc, [5], colorBreakpoints),
@@ -211,7 +211,7 @@ describe('getColorRange', () => {
],
};
- it('returns color range for linear_palette', () => {
+ test('returns color range for linear_palette', () => {
const colorScale = { range: () => ['#ff0000', '#00ff00'] } as any;
const result = getColorRange({
defaultBreakpointsColor: DEFAULT_DECKGL_COLOR,
@@ -224,7 +224,7 @@ describe('getColorRange', () => {
]);
});
- it('returns color range for categorical_palette', () => {
+ test('returns color range for categorical_palette', () => {
const colorScale = { range: () => ['#0000ff', '#00ffff'] } as any;
const result = getColorRange({
defaultBreakpointsColor: DEFAULT_DECKGL_COLOR,
@@ -237,7 +237,7 @@ describe('getColorRange', () => {
]);
});
- it('returns color range for color_breakpoints', () => {
+ test('returns color range for color_breakpoints', () => {
const result = getColorRange({
colorBreakpoints: fdBase.color_breakpoints,
defaultBreakpointsColor: DEFAULT_DECKGL_COLOR,
@@ -255,7 +255,7 @@ describe('getColorRange', () => {
]);
});
- it('returns default color if color_picker is missing', () => {
+ test('returns default color if color_picker is missing', () => {
const result = getColorRange({
defaultBreakpointsColor: DEFAULT_DECKGL_COLOR,
colorSchemeType: 'unknown_type' as ColorSchemeType,
diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/spatialUtils.test.ts b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/spatialUtils.test.ts
index f996cb22710..d9329760cc9 100644
--- a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/spatialUtils.test.ts
+++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/layers/spatialUtils.test.ts
@@ -64,7 +64,7 @@ Object.defineProperty(document, 'getElementById', {
const mockDecode = decode as jest.MockedFunction;
describe('spatialUtils', () => {
- it('getSpatialColumns returns correct columns for latlong type', () => {
+ test('getSpatialColumns returns correct columns for latlong type', () => {
const spatial: SpatialFormData['spatial'] = {
type: 'latlong',
lonCol: 'longitude',
@@ -75,7 +75,7 @@ describe('spatialUtils', () => {
expect(result).toEqual(['longitude', 'latitude']);
});
- it('getSpatialColumns returns correct columns for delimited type', () => {
+ test('getSpatialColumns returns correct columns for delimited type', () => {
const spatial: SpatialFormData['spatial'] = {
type: 'delimited',
lonlatCol: 'coordinates',
@@ -85,7 +85,7 @@ describe('spatialUtils', () => {
expect(result).toEqual(['coordinates']);
});
- it('getSpatialColumns returns correct columns for geohash type', () => {
+ test('getSpatialColumns returns correct columns for geohash type', () => {
const spatial: SpatialFormData['spatial'] = {
type: 'geohash',
geohashCol: 'geohash_code',
@@ -95,16 +95,16 @@ describe('spatialUtils', () => {
expect(result).toEqual(['geohash_code']);
});
- it('getSpatialColumns throws error when spatial is null', () => {
+ test('getSpatialColumns throws error when spatial is null', () => {
expect(() => getSpatialColumns(null as any)).toThrow('Bad spatial key');
});
- it('getSpatialColumns throws error when spatial type is missing', () => {
+ test('getSpatialColumns throws error when spatial type is missing', () => {
const spatial = {} as SpatialFormData['spatial'];
expect(() => getSpatialColumns(spatial)).toThrow('Bad spatial key');
});
- it('getSpatialColumns throws error when latlong columns are missing', () => {
+ test('getSpatialColumns throws error when latlong columns are missing', () => {
const spatial: SpatialFormData['spatial'] = {
type: 'latlong',
};
@@ -113,7 +113,7 @@ describe('spatialUtils', () => {
);
});
- it('getSpatialColumns throws error when delimited column is missing', () => {
+ test('getSpatialColumns throws error when delimited column is missing', () => {
const spatial: SpatialFormData['spatial'] = {
type: 'delimited',
};
@@ -122,7 +122,7 @@ describe('spatialUtils', () => {
);
});
- it('getSpatialColumns throws error when geohash column is missing', () => {
+ test('getSpatialColumns throws error when geohash column is missing', () => {
const spatial: SpatialFormData['spatial'] = {
type: 'geohash',
};
@@ -131,7 +131,7 @@ describe('spatialUtils', () => {
);
});
- it('getSpatialColumns throws error for unknown spatial type', () => {
+ test('getSpatialColumns throws error for unknown spatial type', () => {
const spatial = {
type: 'unknown',
} as any;
@@ -140,7 +140,7 @@ describe('spatialUtils', () => {
);
});
- it('addSpatialNullFilters adds null filters for spatial columns', () => {
+ test('addSpatialNullFilters adds null filters for spatial columns', () => {
const spatial: SpatialFormData['spatial'] = {
type: 'latlong',
lonCol: 'longitude',
@@ -159,7 +159,7 @@ describe('spatialUtils', () => {
]);
});
- it('addSpatialNullFilters returns original filters when spatial is null', () => {
+ test('addSpatialNullFilters returns original filters when spatial is null', () => {
const existingFilters: QueryObjectFilterClause[] = [
{ col: 'test_col', op: '==', val: 'test' },
];
@@ -168,7 +168,7 @@ describe('spatialUtils', () => {
expect(result).toBe(existingFilters);
});
- it('addSpatialNullFilters works with empty filters array', () => {
+ test('addSpatialNullFilters works with empty filters array', () => {
const spatial: SpatialFormData['spatial'] = {
type: 'delimited',
lonlatCol: 'coordinates',
@@ -181,7 +181,7 @@ describe('spatialUtils', () => {
]);
});
- it('buildSpatialQuery throws error when spatial is missing', () => {
+ test('buildSpatialQuery throws error when spatial is missing', () => {
const formData = {} as SpatialFormData;
expect(() => buildSpatialQuery(formData)).toThrow(
@@ -189,7 +189,7 @@ describe('spatialUtils', () => {
);
});
- it('buildSpatialQuery calls buildQueryContext with correct parameters', () => {
+ test('buildSpatialQuery calls buildQueryContext with correct parameters', () => {
const mockBuildQueryContext =
jest.requireMock('@superset-ui/core').buildQueryContext;
const formData: SpatialFormData = {
@@ -209,7 +209,7 @@ describe('spatialUtils', () => {
});
});
- it('processSpatialData processes latlong data correctly', () => {
+ test('processSpatialData processes latlong data correctly', () => {
const records = [
{ longitude: -122.4, latitude: 37.8, count: 10, extra: 'test1' },
{ longitude: -122.5, latitude: 37.9, count: 20, extra: 'test2' },
@@ -237,7 +237,7 @@ describe('spatialUtils', () => {
});
});
- it('processSpatialData processes delimited data correctly', () => {
+ test('processSpatialData processes delimited data correctly', () => {
const records = [
{ coordinates: '-122.4,37.8', count: 15 },
{ coordinates: '-122.5,37.9', count: 25 },
@@ -257,7 +257,7 @@ describe('spatialUtils', () => {
});
});
- it('processSpatialData processes geohash data correctly', () => {
+ test('processSpatialData processes geohash data correctly', () => {
mockDecode.mockReturnValue({
latitude: 37.8,
longitude: -122.4,
@@ -284,7 +284,7 @@ describe('spatialUtils', () => {
expect(mockDecode).toHaveBeenCalledWith('dr5regw3p');
});
- it('processSpatialData reverses coordinates when reverseCheckbox is true', () => {
+ test('processSpatialData reverses coordinates when reverseCheckbox is true', () => {
const records = [{ longitude: -122.4, latitude: 37.8, count: 10 }];
const spatial: SpatialFormData['spatial'] = {
type: 'latlong',
@@ -298,7 +298,7 @@ describe('spatialUtils', () => {
expect(result[0].position).toEqual([37.8, -122.4]);
});
- it('processSpatialData handles invalid coordinates', () => {
+ test('processSpatialData handles invalid coordinates', () => {
const records = [
{ longitude: 'invalid', latitude: 37.8, count: 10 },
{ longitude: -122.4, latitude: NaN, count: 20 },
@@ -318,7 +318,7 @@ describe('spatialUtils', () => {
expect(result).toHaveLength(0);
});
- it('processSpatialData handles missing metric values', () => {
+ test('processSpatialData handles missing metric values', () => {
const records = [
{ longitude: -122.4, latitude: 37.8, count: null },
{ longitude: -122.5, latitude: 37.9 },
@@ -338,7 +338,7 @@ describe('spatialUtils', () => {
expect(result[2].weight).toBe(1);
});
- it('processSpatialData returns empty array for empty records', () => {
+ test('processSpatialData returns empty array for empty records', () => {
const spatial: SpatialFormData['spatial'] = {
type: 'latlong',
lonCol: 'longitude',
@@ -350,7 +350,7 @@ describe('spatialUtils', () => {
expect(result).toEqual([]);
});
- it('processSpatialData returns empty array when spatial is null', () => {
+ test('processSpatialData returns empty array when spatial is null', () => {
const records = [{ longitude: -122.4, latitude: 37.8 }];
const result = processSpatialData(records, null as any);
@@ -358,7 +358,7 @@ describe('spatialUtils', () => {
expect(result).toEqual([]);
});
- it('processSpatialData handles delimited coordinate edge cases', () => {
+ test('processSpatialData handles delimited coordinate edge cases', () => {
const records = [
{ coordinates: '', count: 10 },
{ coordinates: null, count: 20 },
@@ -382,7 +382,7 @@ describe('spatialUtils', () => {
});
});
- it('processSpatialData copies additional properties correctly', () => {
+ test('processSpatialData copies additional properties correctly', () => {
const records = [
{
longitude: -122.4,
@@ -416,7 +416,7 @@ describe('spatialUtils', () => {
expect(result[0]).not.toHaveProperty('extra_col');
});
- it('transformSpatialProps transforms chart props correctly', () => {
+ test('transformSpatialProps transforms chart props correctly', () => {
const mockGetMetricLabel =
jest.requireMock('@superset-ui/core').getMetricLabel;
mockGetMetricLabel.mockReturnValue('count_label');
@@ -510,7 +510,7 @@ describe('spatialUtils', () => {
expect(result.payload.data.metricLabels).toEqual(['count_label']);
});
- it('transformSpatialProps handles missing hooks gracefully', () => {
+ test('transformSpatialProps handles missing hooks gracefully', () => {
const chartProps: ChartProps = {
datasource: {
id: 1,
@@ -556,7 +556,7 @@ describe('spatialUtils', () => {
expect(typeof result.setTooltip).toBe('function');
});
- it('transformSpatialProps handles missing metric', () => {
+ test('transformSpatialProps handles missing metric', () => {
const mockGetMetricLabel =
jest.requireMock('@superset-ui/core').getMetricLabel;
mockGetMetricLabel.mockReturnValue(undefined);
diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/utils.test.ts b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/utils.test.ts
index 9af190089a4..717c6f68ab8 100644
--- a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/utils.test.ts
+++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/utils.test.ts
@@ -20,7 +20,7 @@ import { getColorBreakpointsBuckets, getBreakPoints } from './utils';
import { ColorBreakpointType } from './types';
describe('getColorBreakpointsBuckets', () => {
- it('returns correct buckets for multiple breakpoints', () => {
+ test('returns correct buckets for multiple breakpoints', () => {
const color_breakpoints: ColorBreakpointType[] = [
{ minValue: 0, maxValue: 10, color: { r: 255, g: 0, b: 0, a: 100 } },
{ minValue: 11, maxValue: 20, color: { r: 0, g: 255, b: 0, a: 100 } },
@@ -34,12 +34,12 @@ describe('getColorBreakpointsBuckets', () => {
});
});
- it('returns empty object if color_breakpoints is empty', () => {
+ test('returns empty object if color_breakpoints is empty', () => {
const result = getColorBreakpointsBuckets([]);
expect(result).toEqual({});
});
- it('returns empty object if color_breakpoints is missing', () => {
+ test('returns empty object if color_breakpoints is missing', () => {
const result = getColorBreakpointsBuckets({} as any);
expect(result).toEqual({});
});
@@ -49,7 +49,7 @@ describe('getBreakPoints', () => {
const accessor = (d: any) => d.value;
describe('automatic breakpoint generation', () => {
- it('generates correct number of breakpoints for given buckets', () => {
+ test('generates correct number of breakpoints for given buckets', () => {
const features = [{ value: 0 }, { value: 50 }, { value: 100 }];
const breakPoints = getBreakPoints(
@@ -62,7 +62,7 @@ describe('getBreakPoints', () => {
expect(breakPoints.every(bp => typeof bp === 'string')).toBe(true);
});
- it('ensures data range is fully covered', () => {
+ test('ensures data range is fully covered', () => {
// Test various data ranges to ensure min/max are always included
const testCases = [
{ data: [0, 100], buckets: 5 },
@@ -95,7 +95,7 @@ describe('getBreakPoints', () => {
});
});
- it('handles uniform distribution correctly', () => {
+ test('handles uniform distribution correctly', () => {
const features = [
{ value: 0 },
{ value: 25 },
@@ -124,7 +124,7 @@ describe('getBreakPoints', () => {
});
});
- it('handles single value datasets', () => {
+ test('handles single value datasets', () => {
const features = [{ value: 42 }, { value: 42 }, { value: 42 }];
const breakPoints = getBreakPoints(
@@ -140,7 +140,7 @@ describe('getBreakPoints', () => {
expect(lastBp).toBeGreaterThanOrEqual(42);
});
- it('preserves appropriate precision for different scales', () => {
+ test('preserves appropriate precision for different scales', () => {
const testCases = [
{ data: [0, 1], expectedMaxPrecision: 1 }, // 0.0, 0.2, 0.4...
{ data: [0, 0.1], expectedMaxPrecision: 2 }, // 0.00, 0.02...
@@ -165,7 +165,7 @@ describe('getBreakPoints', () => {
});
});
- it('handles negative values correctly', () => {
+ test('handles negative values correctly', () => {
const features = [
{ value: -100 },
{ value: -50 },
@@ -194,7 +194,7 @@ describe('getBreakPoints', () => {
}
});
- it('handles mixed integer and decimal values', () => {
+ test('handles mixed integer and decimal values', () => {
const features = [
{ value: 1 },
{ value: 2.5 },
@@ -216,7 +216,7 @@ describe('getBreakPoints', () => {
expect(lastBp).toBeGreaterThanOrEqual(8.2);
});
- it('uses floor/ceil for boundary breakpoints to ensure inclusion', () => {
+ test('uses floor/ceil for boundary breakpoints to ensure inclusion', () => {
// Test that Math.floor and Math.ceil are used for boundaries
// This ensures all data points fall within the breakpoint range
@@ -251,7 +251,7 @@ describe('getBreakPoints', () => {
});
});
- it('prevents minimum value exclusion edge case', () => {
+ test('prevents minimum value exclusion edge case', () => {
// Specific edge case test for minimum value exclusion
// Tests the exact scenario where rounding would exclude the min value
@@ -279,7 +279,7 @@ describe('getBreakPoints', () => {
expect(breakPoints[0]).toMatch(/^3(\.0*)?$/);
});
- it('prevents maximum value exclusion edge case', () => {
+ test('prevents maximum value exclusion edge case', () => {
// Specific edge case test for maximum value exclusion
// Tests the exact scenario where rounding would exclude the max value
@@ -309,7 +309,7 @@ describe('getBreakPoints', () => {
});
describe('custom breakpoints', () => {
- it('uses custom breakpoints when provided', () => {
+ test('uses custom breakpoints when provided', () => {
const features = [{ value: 5 }, { value: 15 }, { value: 25 }];
const customBreakPoints = ['0', '10', '20', '30', '40'];
@@ -322,7 +322,7 @@ describe('getBreakPoints', () => {
expect(breakPoints).toEqual(['0', '10', '20', '30', '40']);
});
- it('sorts custom breakpoints in ascending order', () => {
+ test('sorts custom breakpoints in ascending order', () => {
const features = [{ value: 5 }];
const customBreakPoints = ['30', '10', '0', '20'];
@@ -335,7 +335,7 @@ describe('getBreakPoints', () => {
expect(breakPoints).toEqual(['0', '10', '20', '30']);
});
- it('ignores num_buckets when custom breakpoints are provided', () => {
+ test('ignores num_buckets when custom breakpoints are provided', () => {
const features = [{ value: 5 }];
const customBreakPoints = ['0', '50', '100'];
@@ -351,7 +351,7 @@ describe('getBreakPoints', () => {
});
describe('edge cases and error handling', () => {
- it('returns empty array when features are undefined', () => {
+ test('returns empty array when features are undefined', () => {
const breakPoints = getBreakPoints(
{ break_points: [], num_buckets: '5' },
undefined as any,
@@ -361,7 +361,7 @@ describe('getBreakPoints', () => {
expect(breakPoints).toEqual([]);
});
- it('returns empty array when features is null', () => {
+ test('returns empty array when features is null', () => {
const breakPoints = getBreakPoints(
{ break_points: [], num_buckets: '5' },
null as any,
@@ -371,7 +371,7 @@ describe('getBreakPoints', () => {
expect(breakPoints).toEqual([]);
});
- it('returns empty array when all values are undefined', () => {
+ test('returns empty array when all values are undefined', () => {
const features = [
{ value: undefined },
{ value: undefined },
@@ -387,7 +387,7 @@ describe('getBreakPoints', () => {
expect(breakPoints).toEqual([]);
});
- it('handles empty features array', () => {
+ test('handles empty features array', () => {
const breakPoints = getBreakPoints(
{ break_points: [], num_buckets: '5' },
[],
@@ -397,7 +397,7 @@ describe('getBreakPoints', () => {
expect(breakPoints).toEqual([]);
});
- it('handles string values that can be parsed as numbers', () => {
+ test('handles string values that can be parsed as numbers', () => {
const features = [
{ value: '10.5' },
{ value: '20.3' },
@@ -418,7 +418,7 @@ describe('getBreakPoints', () => {
expect(lastBp).toBeGreaterThanOrEqual(30.7);
});
- it('uses default number of buckets when not specified', () => {
+ test('uses default number of buckets when not specified', () => {
const features = [{ value: 0 }, { value: 100 }];
const breakPoints = getBreakPoints(
@@ -431,7 +431,7 @@ describe('getBreakPoints', () => {
expect(breakPoints).toHaveLength(11); // 10 buckets = 11 breakpoints
});
- it('handles Infinity and -Infinity values', () => {
+ test('handles Infinity and -Infinity values', () => {
const features = [
{ value: -Infinity },
{ value: 0 },
@@ -450,7 +450,7 @@ describe('getBreakPoints', () => {
});
describe('breakpoint boundaries validation', () => {
- it('ensures no data points fall outside breakpoint range', () => {
+ test('ensures no data points fall outside breakpoint range', () => {
// Generate random test data
const generateRandomData = (count: number, min: number, max: number) => {
const data = [];
diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/utils/crossFiltersDataMask.test.ts b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/utils/crossFiltersDataMask.test.ts
index 97b992a5dfd..4592bce5dd2 100644
--- a/superset-frontend/plugins/legacy-preset-chart-deckgl/src/utils/crossFiltersDataMask.test.ts
+++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/src/utils/crossFiltersDataMask.test.ts
@@ -57,7 +57,7 @@ const pickingData = {
} as unknown as PickingInfo;
describe('getCrossFilterDataMask', () => {
- it('handles latlong type', () => {
+ test('handles latlong type', () => {
const latlongFormData = {
...formData,
spatial: {
@@ -125,7 +125,7 @@ describe('getCrossFilterDataMask', () => {
expect(dataMask).toStrictEqual(expected);
});
- it('handles latlong type with active filters', () => {
+ test('handles latlong type with active filters', () => {
const latlongFormData = {
...formData,
spatial: {
@@ -183,7 +183,7 @@ describe('getCrossFilterDataMask', () => {
expect(dataMask).toStrictEqual(expected);
});
- it('handles delimited type', () => {
+ test('handles delimited type', () => {
const delimitedFormData = {
...formData,
spatial: {
@@ -236,7 +236,7 @@ describe('getCrossFilterDataMask', () => {
expect(dataMask).toStrictEqual(expected);
});
- it('handles delimited type with reversed lon/lat', () => {
+ test('handles delimited type with reversed lon/lat', () => {
const delimitedFormData = {
...formData,
spatial: {
@@ -290,7 +290,7 @@ describe('getCrossFilterDataMask', () => {
expect(dataMask).toStrictEqual(expected);
});
- it('handles geohash type', () => {
+ test('handles geohash type', () => {
const geohashFormData = {
...formData,
spatial: {
@@ -339,7 +339,7 @@ describe('getCrossFilterDataMask', () => {
expect(dataMask).toStrictEqual(expected);
});
- it('handles start and end postions (Arc Chart)', () => {
+ test('handles start and end postions (Arc Chart)', () => {
const arcFormData = {
...formData,
start_spatial: {
@@ -400,7 +400,7 @@ describe('getCrossFilterDataMask', () => {
expect(dataMask).toStrictEqual(expected);
});
- it('handles Charts with GPU aggregation', () => {
+ test('handles Charts with GPU aggregation', () => {
const latlongGPUFormData = {
...formData,
spatial: {
diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/test/utils/colors.test.ts b/superset-frontend/plugins/legacy-preset-chart-deckgl/test/utils/colors.test.ts
index e624454e483..4691ba489f2 100644
--- a/superset-frontend/plugins/legacy-preset-chart-deckgl/test/utils/colors.test.ts
+++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/test/utils/colors.test.ts
@@ -19,7 +19,7 @@
import { hexToRGB } from '../../src/utils/colors';
describe('colors', () => {
- it('hexToRGB()', () => {
+ test('hexToRGB()', () => {
expect(hexToRGB('#ffffff')).toEqual([255, 255, 255, 255]);
});
});
diff --git a/superset-frontend/plugins/legacy-preset-chart-deckgl/test/utils/getPointsFromPolygon.test.ts b/superset-frontend/plugins/legacy-preset-chart-deckgl/test/utils/getPointsFromPolygon.test.ts
index d8366b1b0ae..f722db31fe4 100644
--- a/superset-frontend/plugins/legacy-preset-chart-deckgl/test/utils/getPointsFromPolygon.test.ts
+++ b/superset-frontend/plugins/legacy-preset-chart-deckgl/test/utils/getPointsFromPolygon.test.ts
@@ -19,7 +19,7 @@
import getPointsFromPolygon from '../../src/utils/getPointsFromPolygon';
describe('getPointsFromPolygon', () => {
- it('handle original input', () => {
+ test('handle original input', () => {
expect(
getPointsFromPolygon({
polygon: [
@@ -32,7 +32,7 @@ describe('getPointsFromPolygon', () => {
[3, 4],
]);
});
- it('handle geojson features', () => {
+ test('handle geojson features', () => {
expect(
getPointsFromPolygon({
polygon: {
diff --git a/superset-frontend/plugins/legacy-preset-chart-nvd3/test/utils.test.ts b/superset-frontend/plugins/legacy-preset-chart-nvd3/test/utils.test.ts
index 192d92e4d03..a883d4c6b7f 100644
--- a/superset-frontend/plugins/legacy-preset-chart-nvd3/test/utils.test.ts
+++ b/superset-frontend/plugins/legacy-preset-chart-nvd3/test/utils.test.ts
@@ -123,15 +123,15 @@ describe('nvd3/utils', () => {
});
describe('getTimeOrNumberFormatter(format)', () => {
- it('is a function', () => {
+ test('is a function', () => {
expect(typeof getTimeOrNumberFormatter).toBe('function');
});
- it('returns a date formatter if format is smart_date', () => {
+ test('returns a date formatter if format is smart_date', () => {
const time = new Date(Date.UTC(2018, 10, 21, 22, 11));
// @ts-expect-error -- getTimeOrNumberFormatter doesn't distinguish return types; accepts Date at runtime
expect(getTimeOrNumberFormatter('smart_date')(time)).toBe('10:11');
});
- it('returns a number formatter otherwise', () => {
+ test('returns a number formatter otherwise', () => {
expect(getTimeOrNumberFormatter('.3s')(3000000)).toBe('3.00M');
expect(getTimeOrNumberFormatter(undefined)(3000100)).toBe('3M');
});
@@ -143,12 +143,12 @@ describe('nvd3/utils', () => {
bar: 'Bar',
};
- it('formats simple labels', () => {
+ test('formats simple labels', () => {
expect(formatLabel('foo')).toBe('foo');
expect(formatLabel(['foo'])).toBe('foo');
expect(formatLabel(['foo', 'bar'])).toBe('foo, bar');
});
- it('formats simple labels with lookups', () => {
+ test('formats simple labels with lookups', () => {
expect(formatLabel('foo', verboseMap)).toBe('Foo');
expect(formatLabel('baz', verboseMap)).toBe('baz');
expect(formatLabel(['foo'], verboseMap)).toBe('Foo');
@@ -156,7 +156,7 @@ describe('nvd3/utils', () => {
'Foo, Bar, baz',
);
});
- it('deals with time shift properly', () => {
+ test('deals with time shift properly', () => {
expect(formatLabel(['foo', '1 hour offset'], verboseMap)).toBe(
'Foo, 1 hour offset',
);
@@ -167,15 +167,15 @@ describe('nvd3/utils', () => {
});
describe('computeYDomain()', () => {
- it('works with invalid data', () => {
+ test('works with invalid data', () => {
expect(computeYDomain('foo')).toEqual([0, 1]);
});
- it('works with all series enabled', () => {
+ test('works with all series enabled', () => {
expect(computeYDomain(DATA)).toEqual([572036107.0, 1034767718.0]);
});
- it('works with some series disabled', () => {
+ test('works with some series disabled', () => {
expect(computeYDomain(DATA_WITH_DISABLED_SERIES)).toEqual([
660881033.0, 668526708.0,
]);
diff --git a/superset-frontend/plugins/legacy-preset-chart-nvd3/test/utils/isTruthy.test.ts b/superset-frontend/plugins/legacy-preset-chart-nvd3/test/utils/isTruthy.test.ts
index f1914ce80ce..952bd930d8d 100644
--- a/superset-frontend/plugins/legacy-preset-chart-nvd3/test/utils/isTruthy.test.ts
+++ b/superset-frontend/plugins/legacy-preset-chart-nvd3/test/utils/isTruthy.test.ts
@@ -19,7 +19,7 @@
import isTruthy from '../../src/utils/isTruthy';
describe('isTruthy', () => {
- it('evals false-looking strings properly', () => {
+ test('evals false-looking strings properly', () => {
expect(isTruthy('f')).toBe(false);
expect(isTruthy('false')).toBe(false);
expect(isTruthy('no')).toBe(false);
@@ -29,7 +29,7 @@ describe('isTruthy', () => {
expect(isTruthy('NO')).toBe(false);
expect(isTruthy('N')).toBe(false);
});
- it('evals true-looking strings properly', () => {
+ test('evals true-looking strings properly', () => {
expect(isTruthy('t')).toBe(true);
expect(isTruthy('true')).toBe(true);
expect(isTruthy('yes')).toBe(true);
@@ -39,19 +39,19 @@ describe('isTruthy', () => {
expect(isTruthy('Yes')).toBe(true);
expect(isTruthy('YES')).toBe(true);
});
- it('evals bools properly', () => {
+ test('evals bools properly', () => {
expect(isTruthy(false)).toBe(false);
expect(isTruthy(true)).toBe(true);
});
- it('evals ints properly', () => {
+ test('evals ints properly', () => {
expect(isTruthy(0)).toBe(false);
expect(isTruthy(1)).toBe(true);
});
- it('evals constants properly', () => {
+ test('evals constants properly', () => {
expect(isTruthy(null)).toBe(false);
expect(isTruthy(undefined)).toBe(false);
});
- it('string auto is false', () => {
+ test('string auto is false', () => {
expect(isTruthy('false')).toBe(false);
});
});
diff --git a/superset-frontend/plugins/legacy-preset-chart-nvd3/test/utils/tokenize.test.ts b/superset-frontend/plugins/legacy-preset-chart-nvd3/test/utils/tokenize.test.ts
index e9c46db9762..9f0bbb71d50 100644
--- a/superset-frontend/plugins/legacy-preset-chart-nvd3/test/utils/tokenize.test.ts
+++ b/superset-frontend/plugins/legacy-preset-chart-nvd3/test/utils/tokenize.test.ts
@@ -22,7 +22,7 @@ import {
} from '../../src/utils/tokenize';
describe('tokenizeToNumericArray', () => {
- it('evals numeric strings properly', () => {
+ test('evals numeric strings properly', () => {
expect(tokenizeToNumericArray('1')).toStrictEqual([1]);
expect(tokenizeToNumericArray('1,2,3,4')).toStrictEqual([1, 2, 3, 4]);
expect(tokenizeToNumericArray('1.1,2.2,3.0,4')).toStrictEqual([
@@ -33,22 +33,22 @@ describe('tokenizeToNumericArray', () => {
]);
});
- it('evals undefined to null', () => {
+ test('evals undefined to null', () => {
expect(tokenizeToNumericArray(undefined)).toBeNull();
});
- it('evals empty strings to null', () => {
+ test('evals empty strings to null', () => {
expect(tokenizeToNumericArray('')).toBeNull();
expect(tokenizeToNumericArray(' ')).toBeNull();
});
- it('throws error on incorrect string', () => {
+ test('throws error on incorrect string', () => {
expect(() => tokenizeToNumericArray('qwerty,1,2,3')).toThrow(Error);
});
});
describe('tokenizeToStringArray', () => {
- it('evals numeric strings properly', () => {
+ test('evals numeric strings properly', () => {
expect(tokenizeToStringArray('a')).toStrictEqual(['a']);
expect(tokenizeToStringArray('1.1 , 2.2, 3.0 ,4')).toStrictEqual([
'1.1',
@@ -65,11 +65,11 @@ describe('tokenizeToStringArray', () => {
]);
});
- it('evals undefined to null', () => {
+ test('evals undefined to null', () => {
expect(tokenizeToStringArray(undefined)).toBeNull();
});
- it('evals empty string to null', () => {
+ test('evals empty string to null', () => {
expect(tokenizeToStringArray('')).toBeNull();
expect(tokenizeToStringArray(' ')).toBeNull();
});
diff --git a/superset-frontend/plugins/plugin-chart-ag-grid-table/test/buildQuery.test.ts b/superset-frontend/plugins/plugin-chart-ag-grid-table/test/buildQuery.test.ts
index bb9411ca98b..0778d6fde58 100644
--- a/superset-frontend/plugins/plugin-chart-ag-grid-table/test/buildQuery.test.ts
+++ b/superset-frontend/plugins/plugin-chart-ag-grid-table/test/buildQuery.test.ts
@@ -39,7 +39,7 @@ const createAdhocColumn = (
describe('plugin-chart-ag-grid-table', () => {
describe('buildQuery - sort mapping for server pagination', () => {
- it('should map string column colId to backend identifier', () => {
+ test('should map string column colId to backend identifier', () => {
const query = buildQuery(
{
...basicFormData,
@@ -55,7 +55,7 @@ describe('plugin-chart-ag-grid-table', () => {
expect(query.orderby).toEqual([['state', true]]);
});
- it('should map AdhocColumn colId by sqlExpression', () => {
+ test('should map AdhocColumn colId by sqlExpression', () => {
const adhocColumn = createAdhocColumn('degree_type', 'Highest Degree');
const query = buildQuery(
@@ -74,7 +74,7 @@ describe('plugin-chart-ag-grid-table', () => {
expect(query.orderby).toEqual([['degree_type', true]]);
});
- it('should map AdhocColumn colId by label', () => {
+ test('should map AdhocColumn colId by label', () => {
const adhocColumn = createAdhocColumn('degree_type', 'Highest Degree');
const query = buildQuery(
@@ -93,7 +93,7 @@ describe('plugin-chart-ag-grid-table', () => {
expect(query.orderby).toEqual([['degree_type', true]]);
});
- it('should map string metric colId to backend identifier', () => {
+ test('should map string metric colId to backend identifier', () => {
const query = buildQuery(
{
...basicFormData,
@@ -110,7 +110,7 @@ describe('plugin-chart-ag-grid-table', () => {
expect(query.orderby).toEqual([['SUM(revenue)', false]]);
});
- it('should map percent metric with % prefix', () => {
+ test('should map percent metric with % prefix', () => {
const query = buildQuery(
{
...basicFormData,
@@ -128,7 +128,7 @@ describe('plugin-chart-ag-grid-table', () => {
expect(query.orderby).toEqual([['revenue', true]]);
});
- it('should handle desc sort direction correctly', () => {
+ test('should handle desc sort direction correctly', () => {
const query = buildQuery(
{
...basicFormData,
@@ -146,7 +146,7 @@ describe('plugin-chart-ag-grid-table', () => {
});
describe('buildQuery - CSV export with sortModel', () => {
- it('should use sortModel for download queries', () => {
+ test('should use sortModel for download queries', () => {
const query = buildQuery(
{
...basicFormData,
@@ -166,7 +166,7 @@ describe('plugin-chart-ag-grid-table', () => {
]);
});
- it('should map sortModel with desc direction', () => {
+ test('should map sortModel with desc direction', () => {
const query = buildQuery(
{
...basicFormData,
@@ -182,7 +182,7 @@ describe('plugin-chart-ag-grid-table', () => {
expect(query.orderby?.[0]).toEqual(['state', false]);
});
- it('should handle multi-column sort from sortModel', () => {
+ test('should handle multi-column sort from sortModel', () => {
const query = buildQuery(
{
...basicFormData,
@@ -207,7 +207,7 @@ describe('plugin-chart-ag-grid-table', () => {
});
describe('buildQuery - stable sort tie-breaker', () => {
- it('should add default orderby as tie-breaker for single-column CSV export', () => {
+ test('should add default orderby as tie-breaker for single-column CSV export', () => {
const query = buildQuery(
{
...basicFormData,
@@ -227,7 +227,7 @@ describe('plugin-chart-ag-grid-table', () => {
]);
});
- it('should not add tie-breaker if primary sort matches default orderby', () => {
+ test('should not add tie-breaker if primary sort matches default orderby', () => {
const query = buildQuery(
{
...basicFormData,
@@ -244,7 +244,7 @@ describe('plugin-chart-ag-grid-table', () => {
expect(query.orderby).toEqual([['count', false]]);
});
- it('should not add tie-breaker for multi-column sorts', () => {
+ test('should not add tie-breaker for multi-column sorts', () => {
const query = buildQuery(
{
...basicFormData,
@@ -267,7 +267,7 @@ describe('plugin-chart-ag-grid-table', () => {
]);
});
- it('should not add tie-breaker for non-download queries with server pagination', () => {
+ test('should not add tie-breaker for non-download queries with server pagination', () => {
const query = buildQuery(
{
...basicFormData,
@@ -285,7 +285,7 @@ describe('plugin-chart-ag-grid-table', () => {
});
describe('buildQuery - filter handling for CSV export', () => {
- it('should apply AG Grid filters for download queries', () => {
+ test('should apply AG Grid filters for download queries', () => {
const query = buildQuery(
{
...basicFormData,
@@ -311,7 +311,7 @@ describe('plugin-chart-ag-grid-table', () => {
});
});
- it('should append AG Grid filters to existing filters', () => {
+ test('should append AG Grid filters to existing filters', () => {
const query = buildQuery(
{
...basicFormData,
@@ -347,7 +347,7 @@ describe('plugin-chart-ag-grid-table', () => {
});
});
- it('should not apply filters for non-download queries', () => {
+ test('should not apply filters for non-download queries', () => {
const query = buildQuery(basicFormData, {
ownState: {
filters: [
@@ -367,7 +367,7 @@ describe('plugin-chart-ag-grid-table', () => {
});
});
- it('should handle empty filters array', () => {
+ test('should handle empty filters array', () => {
const query = buildQuery(
{
...basicFormData,
@@ -385,7 +385,7 @@ describe('plugin-chart-ag-grid-table', () => {
});
describe('buildQuery - column reordering for CSV export', () => {
- it('should reorder columns based on columnOrder', () => {
+ test('should reorder columns based on columnOrder', () => {
const query = buildQuery(
{
...basicFormData,
@@ -402,7 +402,7 @@ describe('plugin-chart-ag-grid-table', () => {
expect(query.columns).toEqual(['city', 'country', 'state']);
});
- it('should reorder metrics based on columnOrder', () => {
+ test('should reorder metrics based on columnOrder', () => {
const query = buildQuery(
{
...basicFormData,
@@ -419,7 +419,7 @@ describe('plugin-chart-ag-grid-table', () => {
expect(query.metrics).toEqual(['profit', 'count', 'revenue']);
});
- it('should preserve unmatched columns at the end', () => {
+ test('should preserve unmatched columns at the end', () => {
const query = buildQuery(
{
...basicFormData,
@@ -438,7 +438,7 @@ describe('plugin-chart-ag-grid-table', () => {
expect(query.columns).toContain('country');
});
- it('should match AdhocColumn by sqlExpression in columnOrder', () => {
+ test('should match AdhocColumn by sqlExpression in columnOrder', () => {
const adhocColumn = createAdhocColumn('degree_type', 'Highest Degree');
const query = buildQuery(
@@ -459,7 +459,7 @@ describe('plugin-chart-ag-grid-table', () => {
});
});
- it('should not reorder for non-download queries', () => {
+ test('should not reorder for non-download queries', () => {
const query = buildQuery(
{
...basicFormData,
@@ -478,7 +478,7 @@ describe('plugin-chart-ag-grid-table', () => {
describe('buildQuery - AG Grid server-side filters', () => {
describe('Simple filters', () => {
- it('should apply agGridSimpleFilters to query.filters', () => {
+ test('should apply agGridSimpleFilters to query.filters', () => {
const query = buildQuery(
{
...basicFormData,
@@ -506,7 +506,7 @@ describe('plugin-chart-ag-grid-table', () => {
});
});
- it('should append simple filters to existing filters', () => {
+ test('should append simple filters to existing filters', () => {
const query = buildQuery(
{
...basicFormData,
@@ -536,7 +536,7 @@ describe('plugin-chart-ag-grid-table', () => {
});
});
- it('should handle empty agGridSimpleFilters array', () => {
+ test('should handle empty agGridSimpleFilters array', () => {
const query = buildQuery(
{
...basicFormData,
@@ -552,7 +552,7 @@ describe('plugin-chart-ag-grid-table', () => {
expect(query.filters).toBeDefined();
});
- it('should not apply simple filters when server pagination is disabled', () => {
+ test('should not apply simple filters when server pagination is disabled', () => {
const query = buildQuery(basicFormData, {
ownState: {
agGridSimpleFilters: [{ col: 'state', op: '==', val: 'CA' }],
@@ -568,7 +568,7 @@ describe('plugin-chart-ag-grid-table', () => {
});
describe('Complex WHERE clause', () => {
- it('should apply agGridComplexWhere to query.extras.where', () => {
+ test('should apply agGridComplexWhere to query.extras.where', () => {
const query = buildQuery(
{
...basicFormData,
@@ -584,7 +584,7 @@ describe('plugin-chart-ag-grid-table', () => {
expect(query.extras?.where).toBe('(age > 18 AND age < 65)');
});
- it('should combine with existing WHERE clause using AND', () => {
+ test('should combine with existing WHERE clause using AND', () => {
const query = buildQuery(
{
...basicFormData,
@@ -609,7 +609,7 @@ describe('plugin-chart-ag-grid-table', () => {
expect(query.extras?.where).toContain(' AND ');
});
- it('should handle empty agGridComplexWhere', () => {
+ test('should handle empty agGridComplexWhere', () => {
const query = buildQuery(
{
...basicFormData,
@@ -626,7 +626,7 @@ describe('plugin-chart-ag-grid-table', () => {
expect(query.extras?.where || undefined).toBeUndefined();
});
- it('should not apply WHERE clause when server pagination is disabled', () => {
+ test('should not apply WHERE clause when server pagination is disabled', () => {
const query = buildQuery(basicFormData, {
ownState: {
agGridComplexWhere: '(age > 18)',
@@ -639,7 +639,7 @@ describe('plugin-chart-ag-grid-table', () => {
});
describe('HAVING clause', () => {
- it('should apply agGridHavingClause to query.extras.having', () => {
+ test('should apply agGridHavingClause to query.extras.having', () => {
const query = buildQuery(
{
...basicFormData,
@@ -656,7 +656,7 @@ describe('plugin-chart-ag-grid-table', () => {
expect(query.extras?.having).toBe('SUM(revenue) > 1000');
});
- it('should combine with existing HAVING clause using AND', () => {
+ test('should combine with existing HAVING clause using AND', () => {
const query = buildQuery(
{
...basicFormData,
@@ -682,7 +682,7 @@ describe('plugin-chart-ag-grid-table', () => {
expect(query.extras?.having).toContain(' AND ');
});
- it('should handle metric filters correctly', () => {
+ test('should handle metric filters correctly', () => {
const query = buildQuery(
{
...basicFormData,
@@ -701,7 +701,7 @@ describe('plugin-chart-ag-grid-table', () => {
);
});
- it('should not apply HAVING clause when server pagination is disabled', () => {
+ test('should not apply HAVING clause when server pagination is disabled', () => {
const query = buildQuery(basicFormData, {
ownState: {
agGridHavingClause: 'SUM(revenue) > 1000',
@@ -714,8 +714,8 @@ describe('plugin-chart-ag-grid-table', () => {
});
describe('Totals query handling', () => {
- it('should exclude AG Grid WHERE filters from totals query', () => {
- const queries = buildQuery(
+ test('should exclude AG Grid WHERE filters from totals query', () => {
+ const { queries } = buildQuery(
{
...basicFormData,
server_pagination: true,
@@ -727,7 +727,7 @@ describe('plugin-chart-ag-grid-table', () => {
agGridComplexWhere: 'age > 18',
},
},
- ).queries;
+ );
const mainQuery = queries[0];
const totalsQuery = queries[2]; // queries[1] is rowcount, queries[2] is totals
@@ -736,8 +736,8 @@ describe('plugin-chart-ag-grid-table', () => {
expect(totalsQuery.extras?.where).toBeUndefined();
});
- it('should preserve non-AG Grid WHERE clauses in totals', () => {
- const queries = buildQuery(
+ test('should preserve non-AG Grid WHERE clauses in totals', () => {
+ const { queries } = buildQuery(
{
...basicFormData,
server_pagination: true,
@@ -756,7 +756,7 @@ describe('plugin-chart-ag-grid-table', () => {
agGridComplexWhere: 'age > 18',
},
},
- ).queries;
+ );
const mainQuery = queries[0];
const totalsQuery = queries[2]; // queries[1] is rowcount, queries[2] is totals
@@ -767,8 +767,8 @@ describe('plugin-chart-ag-grid-table', () => {
expect(totalsQuery.extras?.where).not.toContain('age > 18');
});
- it('should handle totals when AG Grid WHERE is only clause', () => {
- const queries = buildQuery(
+ test('should handle totals when AG Grid WHERE is only clause', () => {
+ const { queries } = buildQuery(
{
...basicFormData,
server_pagination: true,
@@ -780,15 +780,15 @@ describe('plugin-chart-ag-grid-table', () => {
agGridComplexWhere: 'status = "active"',
},
},
- ).queries;
+ );
const totalsQuery = queries[2]; // queries[1] is rowcount, queries[2] is totals
expect(totalsQuery.extras?.where).toBeUndefined();
});
- it('should handle totals with empty WHERE clause after removal', () => {
- const queries = buildQuery(
+ test('should handle totals with empty WHERE clause after removal', () => {
+ const { queries } = buildQuery(
{
...basicFormData,
server_pagination: true,
@@ -807,7 +807,7 @@ describe('plugin-chart-ag-grid-table', () => {
agGridComplexWhere: 'country = "USA"',
},
},
- ).queries;
+ );
const totalsQuery = queries[2]; // queries[1] is rowcount, queries[2] is totals
@@ -815,8 +815,8 @@ describe('plugin-chart-ag-grid-table', () => {
expect(totalsQuery.extras).toBeDefined();
});
- it('should not modify totals query when no AG Grid filters applied', () => {
- const queries = buildQuery(
+ test('should not modify totals query when no AG Grid filters applied', () => {
+ const { queries } = buildQuery(
{
...basicFormData,
server_pagination: true,
@@ -826,7 +826,7 @@ describe('plugin-chart-ag-grid-table', () => {
{
ownState: {},
},
- ).queries;
+ );
const totalsQuery = queries[2]; // queries[1] is rowcount, queries[2] is totals
@@ -836,7 +836,7 @@ describe('plugin-chart-ag-grid-table', () => {
});
describe('Integration - all filter types together', () => {
- it('should apply simple, WHERE, and HAVING filters simultaneously', () => {
+ test('should apply simple, WHERE, and HAVING filters simultaneously', () => {
const query = buildQuery(
{
...basicFormData,
@@ -861,7 +861,7 @@ describe('plugin-chart-ag-grid-table', () => {
expect(query.extras?.having).toBe('SUM(revenue) > 1000');
});
- it('should combine AG Grid filters with adhoc filters', () => {
+ test('should combine AG Grid filters with adhoc filters', () => {
const query = buildQuery(
{
...basicFormData,
@@ -900,7 +900,7 @@ describe('plugin-chart-ag-grid-table', () => {
expect(query.extras?.where).toContain("status = 'active'");
});
- it('should reset currentPage to 0 when filtering', () => {
+ test('should reset currentPage to 0 when filtering', () => {
const query = buildQuery(
{
...basicFormData,
@@ -922,7 +922,7 @@ describe('plugin-chart-ag-grid-table', () => {
});
});
- it('should include filter metadata in ownState', () => {
+ test('should include filter metadata in ownState', () => {
const query = buildQuery(
{
...basicFormData,
@@ -943,8 +943,8 @@ describe('plugin-chart-ag-grid-table', () => {
expect(query).toBeDefined();
});
- it('should handle complex real-world scenario', () => {
- const queries = buildQuery(
+ test('should handle complex real-world scenario', () => {
+ const { queries } = buildQuery(
{
...basicFormData,
server_pagination: true,
@@ -975,7 +975,7 @@ describe('plugin-chart-ag-grid-table', () => {
pageSize: 50,
},
},
- ).queries;
+ );
const mainQuery = queries[0];
const totalsQuery = queries[2]; // queries[1] is rowcount, queries[2] is totals
@@ -995,7 +995,7 @@ describe('plugin-chart-ag-grid-table', () => {
});
describe('Edge cases', () => {
- it('should handle null ownState gracefully', () => {
+ test('should handle null ownState gracefully', () => {
const query = buildQuery(
{
...basicFormData,
@@ -1007,7 +1007,7 @@ describe('plugin-chart-ag-grid-table', () => {
expect(query).toBeDefined();
});
- it('should handle ownState without filter properties', () => {
+ test('should handle ownState without filter properties', () => {
const query = buildQuery(
{
...basicFormData,
@@ -1024,7 +1024,7 @@ describe('plugin-chart-ag-grid-table', () => {
expect(query).toBeDefined();
});
- it('should handle filters with special SQL characters', () => {
+ test('should handle filters with special SQL characters', () => {
const query = buildQuery(
{
...basicFormData,
@@ -1044,7 +1044,7 @@ describe('plugin-chart-ag-grid-table', () => {
});
});
- it('should handle very long filter clauses', () => {
+ test('should handle very long filter clauses', () => {
const longWhereClause = Array(50)
.fill(0)
.map((_, i) => `field${i} > ${i}`)
diff --git a/superset-frontend/plugins/plugin-chart-ag-grid-table/test/utils/agGridFilterConverter.test.ts b/superset-frontend/plugins/plugin-chart-ag-grid-table/test/utils/agGridFilterConverter.test.ts
index b00e3f2f138..a6f95a2932e 100644
--- a/superset-frontend/plugins/plugin-chart-ag-grid-table/test/utils/agGridFilterConverter.test.ts
+++ b/superset-frontend/plugins/plugin-chart-ag-grid-table/test/utils/agGridFilterConverter.test.ts
@@ -26,7 +26,7 @@ import type {
describe('agGridFilterConverter', () => {
describe('Empty and invalid inputs', () => {
- it('should handle empty filter model', () => {
+ test('should handle empty filter model', () => {
const result = convertAgGridFiltersToSQL({});
expect(result.simpleFilters).toEqual([]);
@@ -34,7 +34,7 @@ describe('agGridFilterConverter', () => {
expect(result.havingClause).toBeUndefined();
});
- it('should handle null filter model', () => {
+ test('should handle null filter model', () => {
const result = convertAgGridFiltersToSQL(null as any);
expect(result.simpleFilters).toEqual([]);
@@ -42,7 +42,7 @@ describe('agGridFilterConverter', () => {
expect(result.havingClause).toBeUndefined();
});
- it('should skip invalid column names', () => {
+ test('should skip invalid column names', () => {
const filterModel: AgGridFilterModel = {
valid_column: {
filterType: 'text',
@@ -62,7 +62,7 @@ describe('agGridFilterConverter', () => {
expect(result.simpleFilters[0].col).toBe('valid_column');
});
- it('should skip filters with invalid objects', () => {
+ test('should skip filters with invalid objects', () => {
const filterModel = {
column1: null,
column2: 'invalid string',
@@ -81,7 +81,7 @@ describe('agGridFilterConverter', () => {
});
describe('Simple text filters', () => {
- it('should convert equals filter', () => {
+ test('should convert equals filter', () => {
const filterModel: AgGridFilterModel = {
name: {
filterType: 'text',
@@ -100,7 +100,7 @@ describe('agGridFilterConverter', () => {
});
});
- it('should convert notEqual filter', () => {
+ test('should convert notEqual filter', () => {
const filterModel: AgGridFilterModel = {
status: {
filterType: 'text',
@@ -118,7 +118,7 @@ describe('agGridFilterConverter', () => {
});
});
- it('should convert contains filter with wildcard', () => {
+ test('should convert contains filter with wildcard', () => {
const filterModel: AgGridFilterModel = {
description: {
filterType: 'text',
@@ -136,7 +136,7 @@ describe('agGridFilterConverter', () => {
});
});
- it('should convert notContains filter with wildcard', () => {
+ test('should convert notContains filter with wildcard', () => {
const filterModel: AgGridFilterModel = {
description: {
filterType: 'text',
@@ -154,7 +154,7 @@ describe('agGridFilterConverter', () => {
});
});
- it('should convert startsWith filter with trailing wildcard', () => {
+ test('should convert startsWith filter with trailing wildcard', () => {
const filterModel: AgGridFilterModel = {
email: {
filterType: 'text',
@@ -172,7 +172,7 @@ describe('agGridFilterConverter', () => {
});
});
- it('should convert endsWith filter with leading wildcard', () => {
+ test('should convert endsWith filter with leading wildcard', () => {
const filterModel: AgGridFilterModel = {
email: {
filterType: 'text',
@@ -192,7 +192,7 @@ describe('agGridFilterConverter', () => {
});
describe('Numeric filters', () => {
- it('should convert lessThan filter', () => {
+ test('should convert lessThan filter', () => {
const filterModel: AgGridFilterModel = {
age: {
filterType: 'number',
@@ -210,7 +210,7 @@ describe('agGridFilterConverter', () => {
});
});
- it('should convert lessThanOrEqual filter', () => {
+ test('should convert lessThanOrEqual filter', () => {
const filterModel: AgGridFilterModel = {
price: {
filterType: 'number',
@@ -228,7 +228,7 @@ describe('agGridFilterConverter', () => {
});
});
- it('should convert greaterThan filter', () => {
+ test('should convert greaterThan filter', () => {
const filterModel: AgGridFilterModel = {
score: {
filterType: 'number',
@@ -246,7 +246,7 @@ describe('agGridFilterConverter', () => {
});
});
- it('should convert greaterThanOrEqual filter', () => {
+ test('should convert greaterThanOrEqual filter', () => {
const filterModel: AgGridFilterModel = {
rating: {
filterType: 'number',
@@ -264,7 +264,7 @@ describe('agGridFilterConverter', () => {
});
});
- it('should convert inRange filter to BETWEEN', () => {
+ test('should convert inRange filter to BETWEEN', () => {
const filterModel: AgGridFilterModel = {
age: {
filterType: 'number',
@@ -287,7 +287,7 @@ describe('agGridFilterConverter', () => {
});
describe('Null/blank filters', () => {
- it('should convert blank filter to IS NULL', () => {
+ test('should convert blank filter to IS NULL', () => {
const filterModel: AgGridFilterModel = {
optional_field: {
filterType: 'text',
@@ -304,7 +304,7 @@ describe('agGridFilterConverter', () => {
});
});
- it('should convert notBlank filter to IS NOT NULL', () => {
+ test('should convert notBlank filter to IS NOT NULL', () => {
const filterModel: AgGridFilterModel = {
required_field: {
filterType: 'text',
@@ -323,7 +323,7 @@ describe('agGridFilterConverter', () => {
});
describe('Set filters', () => {
- it('should convert set filter to IN operator', () => {
+ test('should convert set filter to IN operator', () => {
const filterModel: AgGridFilterModel = {
status: {
filterType: 'set',
@@ -340,7 +340,7 @@ describe('agGridFilterConverter', () => {
});
});
- it('should handle set filter with numeric values', () => {
+ test('should handle set filter with numeric values', () => {
const filterModel: AgGridFilterModel = {
priority: {
filterType: 'set',
@@ -357,7 +357,7 @@ describe('agGridFilterConverter', () => {
});
});
- it('should skip empty set filters', () => {
+ test('should skip empty set filters', () => {
const filterModel: AgGridFilterModel = {
status: {
filterType: 'set',
@@ -372,7 +372,7 @@ describe('agGridFilterConverter', () => {
});
describe('Compound filters', () => {
- it('should combine conditions with AND operator', () => {
+ test('should combine conditions with AND operator', () => {
const filterModel: AgGridFilterModel = {
age: {
filterType: 'number',
@@ -395,7 +395,7 @@ describe('agGridFilterConverter', () => {
expect(result.complexWhere).toBe('(age >= 18 AND age < 65)');
});
- it('should combine conditions with OR operator', () => {
+ test('should combine conditions with OR operator', () => {
const filterModel: AgGridFilterModel = {
status: {
filterType: 'text',
@@ -420,7 +420,7 @@ describe('agGridFilterConverter', () => {
);
});
- it('should handle compound filter with inRange', () => {
+ test('should handle compound filter with inRange', () => {
const filterModel: AgGridFilterModel = {
date: {
filterType: 'date',
@@ -444,7 +444,7 @@ describe('agGridFilterConverter', () => {
expect(result.complexWhere).toContain('IS NOT NULL');
});
- it('should handle compound filter with invalid conditions gracefully', () => {
+ test('should handle compound filter with invalid conditions gracefully', () => {
const filterModel: AgGridFilterModel = {
field: {
filterType: 'text',
@@ -468,7 +468,7 @@ describe('agGridFilterConverter', () => {
expect(result.complexWhere).toBe("field = 'valid'");
});
- it('should handle multi-condition filters (conditions array)', () => {
+ test('should handle multi-condition filters (conditions array)', () => {
const filterModel: AgGridFilterModel = {
category: {
filterType: 'text',
@@ -502,7 +502,7 @@ describe('agGridFilterConverter', () => {
});
describe('Metric vs Dimension separation', () => {
- it('should put dimension filters in simpleFilters/complexWhere', () => {
+ test('should put dimension filters in simpleFilters/complexWhere', () => {
const filterModel: AgGridFilterModel = {
state: {
filterType: 'text',
@@ -517,7 +517,7 @@ describe('agGridFilterConverter', () => {
expect(result.havingClause).toBeUndefined();
});
- it('should put metric filters in havingClause', () => {
+ test('should put metric filters in havingClause', () => {
const filterModel: AgGridFilterModel = {
'SUM(revenue)': {
filterType: 'number',
@@ -532,7 +532,7 @@ describe('agGridFilterConverter', () => {
expect(result.havingClause).toBe('SUM(revenue) > 1000');
});
- it('should separate mixed metric and dimension filters', () => {
+ test('should separate mixed metric and dimension filters', () => {
const filterModel: AgGridFilterModel = {
state: {
filterType: 'text',
@@ -559,7 +559,7 @@ describe('agGridFilterConverter', () => {
expect(result.havingClause).toBe('SUM(revenue) > 1000');
});
- it('should handle metric set filters in HAVING clause', () => {
+ test('should handle metric set filters in HAVING clause', () => {
const filterModel: AgGridFilterModel = {
'AVG(score)': {
filterType: 'set',
@@ -573,7 +573,7 @@ describe('agGridFilterConverter', () => {
expect(result.havingClause).toBe('AVG(score) IN (90, 95, 100)');
});
- it('should handle metric blank filters in HAVING clause', () => {
+ test('should handle metric blank filters in HAVING clause', () => {
const filterModel: AgGridFilterModel = {
'COUNT(*)': {
filterType: 'number',
@@ -588,7 +588,7 @@ describe('agGridFilterConverter', () => {
});
describe('Multiple filters combination', () => {
- it('should handle both simple and compound filters', () => {
+ test('should handle both simple and compound filters', () => {
const filterModel: AgGridFilterModel = {
status: {
filterType: 'text',
@@ -625,7 +625,7 @@ describe('agGridFilterConverter', () => {
expect(result.complexWhere).toBe('(age > 18 AND age < 65)');
});
- it('should combine multiple HAVING filters with AND', () => {
+ test('should combine multiple HAVING filters with AND', () => {
const filterModel: AgGridFilterModel = {
'SUM(revenue)': {
filterType: 'number',
@@ -649,7 +649,7 @@ describe('agGridFilterConverter', () => {
);
});
- it('should handle single WHERE filter without parentheses', () => {
+ test('should handle single WHERE filter without parentheses', () => {
const filterModel: AgGridFilterModel = {
age: {
filterType: 'number',
@@ -674,7 +674,7 @@ describe('agGridFilterConverter', () => {
});
describe('SQL injection prevention', () => {
- it('should escape single quotes in filter values', () => {
+ test('should escape single quotes in filter values', () => {
const filterModel: AgGridFilterModel = {
name: {
filterType: 'text',
@@ -689,7 +689,7 @@ describe('agGridFilterConverter', () => {
// The actual escaping happens in SQL generation, but value is preserved
});
- it('should escape single quotes in complex filters', () => {
+ test('should escape single quotes in complex filters', () => {
const filterModel: AgGridFilterModel = {
description: {
filterType: 'text',
@@ -704,7 +704,7 @@ describe('agGridFilterConverter', () => {
expect(result.simpleFilters[0].val).toBe("%It's working%");
});
- it('should reject column names with SQL injection attempts', () => {
+ test('should reject column names with SQL injection attempts', () => {
const filterModel: AgGridFilterModel = {
"name'; DROP TABLE users--": {
filterType: 'text',
@@ -718,7 +718,7 @@ describe('agGridFilterConverter', () => {
expect(result.simpleFilters).toHaveLength(0);
});
- it('should reject column names with special characters', () => {
+ test('should reject column names with special characters', () => {
const filterModel: AgGridFilterModel = {
'column': {
filterType: 'text',
@@ -732,7 +732,7 @@ describe('agGridFilterConverter', () => {
expect(result.simpleFilters).toHaveLength(0);
});
- it('should accept valid column names with allowed special characters', () => {
+ test('should accept valid column names with allowed special characters', () => {
const filterModel: AgGridFilterModel = {
valid_column_123: {
filterType: 'text',
@@ -756,7 +756,7 @@ describe('agGridFilterConverter', () => {
expect(result.simpleFilters).toHaveLength(3);
});
- it('should handle very long column names', () => {
+ test('should handle very long column names', () => {
const longColumnName = 'a'.repeat(300);
const filterModel: AgGridFilterModel = {
[longColumnName]: {
@@ -774,7 +774,7 @@ describe('agGridFilterConverter', () => {
});
describe('Edge cases', () => {
- it('should skip filters with missing type', () => {
+ test('should skip filters with missing type', () => {
const filterModel: AgGridFilterModel = {
column: {
filterType: 'text',
@@ -787,7 +787,7 @@ describe('agGridFilterConverter', () => {
expect(result.simpleFilters).toHaveLength(0);
});
- it('should skip filters with unknown operator type', () => {
+ test('should skip filters with unknown operator type', () => {
const filterModel: AgGridFilterModel = {
column: {
filterType: 'text',
@@ -801,7 +801,7 @@ describe('agGridFilterConverter', () => {
expect(result.simpleFilters).toHaveLength(0);
});
- it('should skip filters with invalid value types', () => {
+ test('should skip filters with invalid value types', () => {
const filterModel: AgGridFilterModel = {
column: {
filterType: 'text',
@@ -815,7 +815,7 @@ describe('agGridFilterConverter', () => {
expect(result.simpleFilters).toHaveLength(0);
});
- it('should handle boolean filter values', () => {
+ test('should handle boolean filter values', () => {
const filterModel: AgGridFilterModel = {
is_active: {
filterType: 'boolean',
@@ -833,7 +833,7 @@ describe('agGridFilterConverter', () => {
});
});
- it('should handle null filter values for blank operators', () => {
+ test('should handle null filter values for blank operators', () => {
const filterModel: AgGridFilterModel = {
field: {
filterType: 'text',
@@ -847,7 +847,7 @@ describe('agGridFilterConverter', () => {
expect(result.simpleFilters[0].val).toBeNull();
});
- it('should handle metric filters with set filter', () => {
+ test('should handle metric filters with set filter', () => {
const filterModel: AgGridFilterModel = {
'SUM(amount)': {
filterType: 'set',
diff --git a/superset-frontend/plugins/plugin-chart-ag-grid-table/test/utils/filterStateManager.test.ts b/superset-frontend/plugins/plugin-chart-ag-grid-table/test/utils/filterStateManager.test.ts
index a15e3f1e2f9..92ef3b05e9a 100644
--- a/superset-frontend/plugins/plugin-chart-ag-grid-table/test/utils/filterStateManager.test.ts
+++ b/superset-frontend/plugins/plugin-chart-ag-grid-table/test/utils/filterStateManager.test.ts
@@ -23,7 +23,7 @@ import { FILTER_INPUT_POSITIONS } from '../../src/consts';
describe('filterStateManager', () => {
describe('getCompleteFilterState', () => {
- it('should return empty state when gridRef.current is null', async () => {
+ test('should return empty state when gridRef.current is null', async () => {
const gridRef = { current: null } as RefObject;
const result = await getCompleteFilterState(gridRef, []);
@@ -38,7 +38,7 @@ describe('filterStateManager', () => {
});
});
- it('should return empty state when gridRef.current.api is undefined', async () => {
+ test('should return empty state when gridRef.current.api is undefined', async () => {
const gridRef = {
current: { api: undefined } as any,
} as RefObject;
@@ -55,7 +55,7 @@ describe('filterStateManager', () => {
});
});
- it('should convert simple filters correctly', async () => {
+ test('should convert simple filters correctly', async () => {
const filterModel = {
name: { filterType: 'text', type: 'equals', filter: 'John' },
age: { filterType: 'number', type: 'greaterThan', filter: 25 },
@@ -86,7 +86,7 @@ describe('filterStateManager', () => {
});
});
- it('should separate dimension and metric filters', async () => {
+ test('should separate dimension and metric filters', async () => {
const filterModel = {
state: { filterType: 'text', type: 'equals', filter: 'CA' },
'SUM(revenue)': {
@@ -115,7 +115,7 @@ describe('filterStateManager', () => {
expect(result.havingClause).toBe('SUM(revenue) > 1000');
});
- it('should detect first input position when active element is in first condition body', async () => {
+ test('should detect first input position when active element is in first condition body', async () => {
const filterModel = {
name: { filterType: 'text', type: 'equals', filter: 'test' },
};
@@ -153,7 +153,7 @@ describe('filterStateManager', () => {
expect(result.inputPosition).toBe(FILTER_INPUT_POSITIONS.FIRST);
});
- it('should detect second input position when active element is in second condition body', async () => {
+ test('should detect second input position when active element is in second condition body', async () => {
const filterModel = {
age: {
filterType: 'number',
@@ -197,7 +197,7 @@ describe('filterStateManager', () => {
expect(result.inputPosition).toBe(FILTER_INPUT_POSITIONS.SECOND);
});
- it('should return unknown position when active element is not in any condition body', async () => {
+ test('should return unknown position when active element is not in any condition body', async () => {
const filterModel = {
name: { filterType: 'text', type: 'equals', filter: 'test' },
};
@@ -233,7 +233,7 @@ describe('filterStateManager', () => {
expect(result.lastFilteredColumn).toBeUndefined();
});
- it('should handle multiple filtered columns and detect the correct one', async () => {
+ test('should handle multiple filtered columns and detect the correct one', async () => {
const filterModel = {
name: { filterType: 'text', type: 'equals', filter: 'John' },
age: { filterType: 'number', type: 'greaterThan', filter: 25 },
@@ -287,7 +287,7 @@ describe('filterStateManager', () => {
expect(result.inputPosition).toBe(FILTER_INPUT_POSITIONS.FIRST);
});
- it('should handle filter instance without eConditionBodies', async () => {
+ test('should handle filter instance without eConditionBodies', async () => {
const filterModel = {
name: { filterType: 'text', type: 'equals', filter: 'test' },
};
@@ -314,7 +314,7 @@ describe('filterStateManager', () => {
expect(result.lastFilteredColumn).toBeUndefined();
});
- it('should handle empty filter model', async () => {
+ test('should handle empty filter model', async () => {
const filterModel = {};
const mockApi = {
@@ -335,7 +335,7 @@ describe('filterStateManager', () => {
expect(result.inputPosition).toBe(FILTER_INPUT_POSITIONS.UNKNOWN);
});
- it('should handle compound filters correctly', async () => {
+ test('should handle compound filters correctly', async () => {
const filterModel = {
age: {
filterType: 'number',
@@ -363,7 +363,7 @@ describe('filterStateManager', () => {
expect(result.complexWhere).toBe('(age >= 18 AND age < 65)');
});
- it('should handle set filters correctly', async () => {
+ test('should handle set filters correctly', async () => {
const filterModel = {
status: {
filterType: 'set',
@@ -390,7 +390,7 @@ describe('filterStateManager', () => {
});
});
- it('should break detection loop after finding active element', async () => {
+ test('should break detection loop after finding active element', async () => {
const filterModel = {
col1: { filterType: 'text', type: 'equals', filter: 'a' },
col2: { filterType: 'text', type: 'equals', filter: 'b' },
@@ -405,7 +405,7 @@ describe('filterStateManager', () => {
const mockApi = {
getFilterModel: jest.fn(() => filterModel),
getColumnFilterInstance: jest.fn((colId: string) => {
- callCount++;
+ callCount += 1;
// Return match on col2
if (colId === 'col2') {
return Promise.resolve({
@@ -437,7 +437,7 @@ describe('filterStateManager', () => {
expect(callCount).toBeLessThanOrEqual(2);
});
- it('should handle null filter instance gracefully', async () => {
+ test('should handle null filter instance gracefully', async () => {
const filterModel = {
name: { filterType: 'text', type: 'equals', filter: 'test' },
};
@@ -457,7 +457,7 @@ describe('filterStateManager', () => {
expect(result.originalFilterModel).toEqual(filterModel);
});
- it('should maintain filter model reference integrity', async () => {
+ test('should maintain filter model reference integrity', async () => {
const originalFilterModel = {
name: { filterType: 'text', type: 'equals', filter: 'test' },
};
@@ -477,7 +477,7 @@ describe('filterStateManager', () => {
expect(result.originalFilterModel).toBe(originalFilterModel);
});
- it('should detect active element in eJoinAnds array', async () => {
+ test('should detect active element in eJoinAnds array', async () => {
const filterModel = {
age: {
filterType: 'number',
@@ -524,7 +524,7 @@ describe('filterStateManager', () => {
expect(result.inputPosition).toBe(FILTER_INPUT_POSITIONS.FIRST);
});
- it('should detect active element in eJoinOrs array', async () => {
+ test('should detect active element in eJoinOrs array', async () => {
const filterModel = {
status: {
filterType: 'text',
@@ -571,7 +571,7 @@ describe('filterStateManager', () => {
expect(result.inputPosition).toBe(FILTER_INPUT_POSITIONS.FIRST);
});
- it('should check condition bodies before join operators', async () => {
+ test('should check condition bodies before join operators', async () => {
const filterModel = {
name: { filterType: 'text', type: 'equals', filter: 'test' },
};
@@ -613,7 +613,7 @@ describe('filterStateManager', () => {
expect(result.inputPosition).toBe(FILTER_INPUT_POSITIONS.SECOND);
});
- it('should handle multiple eJoinAnds elements', async () => {
+ test('should handle multiple eJoinAnds elements', async () => {
const filterModel = {
score: { filterType: 'number', type: 'greaterThan', filter: 90 },
};
diff --git a/superset-frontend/plugins/plugin-chart-ag-grid-table/test/utils/getInitialFilterModel.test.ts b/superset-frontend/plugins/plugin-chart-ag-grid-table/test/utils/getInitialFilterModel.test.ts
index 5a8822c2bed..985ffdde9d8 100644
--- a/superset-frontend/plugins/plugin-chart-ag-grid-table/test/utils/getInitialFilterModel.test.ts
+++ b/superset-frontend/plugins/plugin-chart-ag-grid-table/test/utils/getInitialFilterModel.test.ts
@@ -21,7 +21,7 @@ import type { AgGridChartState } from '@superset-ui/core';
describe('getInitialFilterModel', () => {
describe('Priority: chartState > serverPaginationData', () => {
- it('should prioritize chartState.filterModel over serverPaginationData', () => {
+ test('should prioritize chartState.filterModel over serverPaginationData', () => {
const chartState: Partial = {
filterModel: {
name: {
@@ -47,7 +47,7 @@ describe('getInitialFilterModel', () => {
expect(result).toEqual(chartState.filterModel);
});
- it('should use serverPaginationData when chartState.filterModel is unavailable', () => {
+ test('should use serverPaginationData when chartState.filterModel is unavailable', () => {
const chartState: Partial = {};
const serverPaginationData = {
@@ -65,7 +65,7 @@ describe('getInitialFilterModel', () => {
expect(result).toEqual(serverPaginationData.agGridFilterModel);
});
- it('should use serverPaginationData when chartState is undefined', () => {
+ test('should use serverPaginationData when chartState is undefined', () => {
const serverPaginationData = {
agGridFilterModel: {
status: { filterType: 'text', type: 'equals', filter: 'active' },
@@ -83,7 +83,7 @@ describe('getInitialFilterModel', () => {
});
describe('Empty object handling', () => {
- it('should return undefined when chartState.filterModel is empty object', () => {
+ test('should return undefined when chartState.filterModel is empty object', () => {
const chartState: Partial = {
filterModel: {},
};
@@ -104,7 +104,7 @@ describe('getInitialFilterModel', () => {
expect(result).toEqual(serverPaginationData.agGridFilterModel);
});
- it('should return undefined when serverPaginationData.agGridFilterModel is empty object', () => {
+ test('should return undefined when serverPaginationData.agGridFilterModel is empty object', () => {
const chartState: Partial = {};
const serverPaginationData = {
@@ -120,7 +120,7 @@ describe('getInitialFilterModel', () => {
expect(result).toBeUndefined();
});
- it('should handle both being empty objects', () => {
+ test('should handle both being empty objects', () => {
const chartState: Partial = {
filterModel: {},
};
@@ -140,19 +140,19 @@ describe('getInitialFilterModel', () => {
});
describe('Undefined/null handling', () => {
- it('should return undefined when all inputs are undefined', () => {
+ test('should return undefined when all inputs are undefined', () => {
const result = getInitialFilterModel(undefined, undefined, true);
expect(result).toBeUndefined();
});
- it('should return undefined when chartState and serverPaginationData are undefined', () => {
+ test('should return undefined when chartState and serverPaginationData are undefined', () => {
const result = getInitialFilterModel(undefined, undefined, false);
expect(result).toBeUndefined();
});
- it('should return undefined when serverPagination is disabled', () => {
+ test('should return undefined when serverPagination is disabled', () => {
const chartState: Partial = {};
const serverPaginationData = {
@@ -170,7 +170,7 @@ describe('getInitialFilterModel', () => {
expect(result).toBeUndefined();
});
- it('should use chartState even when serverPagination is disabled', () => {
+ test('should use chartState even when serverPagination is disabled', () => {
const chartState: Partial = {
filterModel: {
name: {
@@ -199,7 +199,7 @@ describe('getInitialFilterModel', () => {
});
describe('Complex filter models', () => {
- it('should handle complex chartState filter model', () => {
+ test('should handle complex chartState filter model', () => {
const chartState: Partial = {
filterModel: {
name: { filterType: 'text', type: 'equals', filter: 'John' },
@@ -222,7 +222,7 @@ describe('getInitialFilterModel', () => {
expect(result).toEqual(chartState.filterModel);
});
- it('should handle complex serverPaginationData filter model', () => {
+ test('should handle complex serverPaginationData filter model', () => {
const serverPaginationData = {
agGridFilterModel: {
category: { filterType: 'text', type: 'contains', filter: 'tech' },
@@ -241,7 +241,7 @@ describe('getInitialFilterModel', () => {
});
describe('Real-world scenarios', () => {
- it('should handle permalink scenario with chartState', () => {
+ test('should handle permalink scenario with chartState', () => {
// User shares a permalink with saved filter state
const chartState: Partial = {
filterModel: {
@@ -258,7 +258,7 @@ describe('getInitialFilterModel', () => {
expect(result?.revenue).toBeDefined();
});
- it('should handle fresh page load with server state', () => {
+ test('should handle fresh page load with server state', () => {
// Fresh page load - no chartState, but has serverPaginationData from ownState
const serverPaginationData = {
agGridFilterModel: {
@@ -281,7 +281,7 @@ describe('getInitialFilterModel', () => {
expect(result).toEqual(serverPaginationData.agGridFilterModel);
});
- it('should handle chart without any filters applied', () => {
+ test('should handle chart without any filters applied', () => {
// No filters applied anywhere
const chartState: Partial = {
columnState: [],
@@ -301,7 +301,7 @@ describe('getInitialFilterModel', () => {
expect(result).toBeUndefined();
});
- it('should handle transition from no filters to filters via permalink', () => {
+ test('should handle transition from no filters to filters via permalink', () => {
// User applies filters, creates permalink, then loads it
const chartState: Partial = {
filterModel: {
@@ -324,7 +324,7 @@ describe('getInitialFilterModel', () => {
});
describe('Edge cases', () => {
- it('should handle null values in serverPaginationData', () => {
+ test('should handle null values in serverPaginationData', () => {
const serverPaginationData = {
agGridFilterModel: null as any,
};
@@ -338,7 +338,7 @@ describe('getInitialFilterModel', () => {
expect(result).toBeUndefined();
});
- it('should handle serverPaginationData without agGridFilterModel key', () => {
+ test('should handle serverPaginationData without agGridFilterModel key', () => {
const serverPaginationData = {
currentPage: 0,
pageSize: 20,
@@ -353,7 +353,7 @@ describe('getInitialFilterModel', () => {
expect(result).toBeUndefined();
});
- it('should handle chartState with null filterModel', () => {
+ test('should handle chartState with null filterModel', () => {
const chartState: Partial = {
filterModel: null as any,
};
@@ -373,7 +373,7 @@ describe('getInitialFilterModel', () => {
expect(result).toEqual(serverPaginationData.agGridFilterModel);
});
- it('should handle serverPagination undefined (defaults to false)', () => {
+ test('should handle serverPagination undefined (defaults to false)', () => {
const serverPaginationData = {
agGridFilterModel: {
name: { filterType: 'text', type: 'equals', filter: 'test' },
@@ -389,7 +389,7 @@ describe('getInitialFilterModel', () => {
expect(result).toBeUndefined();
});
- it('should preserve filter model structure without modification', () => {
+ test('should preserve filter model structure without modification', () => {
const originalFilterModel = {
complexFilter: {
filterType: 'number',
diff --git a/superset-frontend/plugins/plugin-chart-cartodiagram/test/components/chartLayer.test.ts b/superset-frontend/plugins/plugin-chart-cartodiagram/test/components/chartLayer.test.ts
index b3418f00ca5..d35326e23dd 100644
--- a/superset-frontend/plugins/plugin-chart-cartodiagram/test/components/chartLayer.test.ts
+++ b/superset-frontend/plugins/plugin-chart-cartodiagram/test/components/chartLayer.test.ts
@@ -21,7 +21,7 @@ import { ChartLayer } from '../../src/components/ChartLayer';
import { ChartLayerOptions } from '../../src/types';
describe('ChartLayer', () => {
- it('creates div and loading mask', () => {
+ test('creates div and loading mask', () => {
const options: ChartLayerOptions = {
chartVizType: 'pie',
locale: 'en',
@@ -32,7 +32,7 @@ describe('ChartLayer', () => {
expect(chartLayer.div).toBeDefined();
});
- it('can remove chart elements', () => {
+ test('can remove chart elements', () => {
const options: ChartLayerOptions = {
chartVizType: 'pie',
locale: 'en',
diff --git a/superset-frontend/plugins/plugin-chart-cartodiagram/test/index.test.ts b/superset-frontend/plugins/plugin-chart-cartodiagram/test/index.test.ts
index a43ce12cade..24931495640 100644
--- a/superset-frontend/plugins/plugin-chart-cartodiagram/test/index.test.ts
+++ b/superset-frontend/plugins/plugin-chart-cartodiagram/test/index.test.ts
@@ -27,7 +27,7 @@ import { CartodiagramPlugin } from '../src';
* properly transform the data and/or any resulting props).
*/
describe('CartodiagramPlugin', () => {
- it('exists', () => {
+ test('exists', () => {
expect(CartodiagramPlugin).toBeDefined();
});
});
diff --git a/superset-frontend/plugins/plugin-chart-cartodiagram/test/plugin/buildQuery.test.ts b/superset-frontend/plugins/plugin-chart-cartodiagram/test/plugin/buildQuery.test.ts
index 7b0da000e58..a4132d25195 100644
--- a/superset-frontend/plugins/plugin-chart-cartodiagram/test/plugin/buildQuery.test.ts
+++ b/superset-frontend/plugins/plugin-chart-cartodiagram/test/plugin/buildQuery.test.ts
@@ -53,12 +53,12 @@ describe('CartodiagramPlugin buildQuery', () => {
registry.clear();
});
- it('should call the buildQuery function of the referenced chart', () => {
+ test('should call the buildQuery function of the referenced chart', () => {
buildQuery(formData);
expect(chartQueryBuilderMock.mock.calls).toHaveLength(1);
});
- it('should build groupby with geom in form data', () => {
+ test('should build groupby with geom in form data', () => {
const expectedParams = { ...selectedChartParams, groupby: ['geom'] };
buildQuery(formData);
diff --git a/superset-frontend/plugins/plugin-chart-cartodiagram/test/plugin/index.test.ts b/superset-frontend/plugins/plugin-chart-cartodiagram/test/plugin/index.test.ts
index 04563b081b8..0abd0c5b121 100644
--- a/superset-frontend/plugins/plugin-chart-cartodiagram/test/plugin/index.test.ts
+++ b/superset-frontend/plugins/plugin-chart-cartodiagram/test/plugin/index.test.ts
@@ -20,7 +20,7 @@
import CartodiagramPlugin from '../../src/CartodiagramPlugin';
describe('CartodiagramPlugin', () => {
- it('exists', () => {
+ test('exists', () => {
expect(CartodiagramPlugin).toBeDefined();
});
});
diff --git a/superset-frontend/plugins/plugin-chart-cartodiagram/test/plugin/transformProps.test.ts b/superset-frontend/plugins/plugin-chart-cartodiagram/test/plugin/transformProps.test.ts
index ce3575c67a1..e59b46955c1 100644
--- a/superset-frontend/plugins/plugin-chart-cartodiagram/test/plugin/transformProps.test.ts
+++ b/superset-frontend/plugins/plugin-chart-cartodiagram/test/plugin/transformProps.test.ts
@@ -113,13 +113,13 @@ describe('CartodiagramPlugin transformProps', () => {
registry.clear();
});
- it('should call the transform props function of the referenced chart', () => {
+ test('should call the transform props function of the referenced chart', () => {
transformProps(chartProps);
expect(chartTransformPropsPieMock).toHaveBeenCalled();
expect(chartTransformPropsTimeseriesMock).not.toHaveBeenCalled();
});
- it('should transform chart props for viz', () => {
+ test('should transform chart props for viz', () => {
const transformedProps = transformProps(chartProps);
expect(transformedProps).toEqual(
expect.objectContaining({
diff --git a/superset-frontend/plugins/plugin-chart-cartodiagram/test/util/chartUtil.test.ts b/superset-frontend/plugins/plugin-chart-cartodiagram/test/util/chartUtil.test.ts
index 891ac9541bf..eceffe3fedb 100644
--- a/superset-frontend/plugins/plugin-chart-cartodiagram/test/util/chartUtil.test.ts
+++ b/superset-frontend/plugins/plugin-chart-cartodiagram/test/util/chartUtil.test.ts
@@ -55,7 +55,7 @@ describe('chartUtil', () => {
};
describe('simplifyConfig', () => {
- it('removes the refs property from a feature', () => {
+ test('removes the refs property from a feature', () => {
const simplifiedConfig = simplifyConfig(configA);
const propKeys = Object.keys(simplifiedConfig.features[0].properties);
@@ -64,12 +64,12 @@ describe('chartUtil', () => {
});
describe('isChartConfigEqual', () => {
- it('returns true, if configurations are equal', () => {
+ test('returns true, if configurations are equal', () => {
const isEqual = isChartConfigEqual(configA, structuredClone(configA));
expect(isEqual).toBe(true);
});
- it('returns false if configurations are not equal', () => {
+ test('returns false if configurations are not equal', () => {
const isEqual = isChartConfigEqual(configA, configB);
expect(isEqual).toBe(false);
});
diff --git a/superset-frontend/plugins/plugin-chart-cartodiagram/test/util/controlPanelUtil.test.tsx b/superset-frontend/plugins/plugin-chart-cartodiagram/test/util/controlPanelUtil.test.tsx
index 88e1e3b9e83..4ce97c4a340 100644
--- a/superset-frontend/plugins/plugin-chart-cartodiagram/test/util/controlPanelUtil.test.tsx
+++ b/superset-frontend/plugins/plugin-chart-cartodiagram/test/util/controlPanelUtil.test.tsx
@@ -28,7 +28,7 @@ import {
describe('controlPanelUtil', () => {
describe('getLayerConfig', () => {
- it('returns the correct layer config', () => {
+ test('returns the correct layer config', () => {
const layerConfigs: CustomControlItem = {
name: 'layer_configs',
config: {
@@ -82,14 +82,14 @@ describe('controlPanelUtil', () => {
});
describe('selectedChartMutator', () => {
- it('returns empty array for empty inputs', () => {
+ test('returns empty array for empty inputs', () => {
const response = {};
const value = undefined;
const result = selectedChartMutator(response, value);
expect(result).toEqual([]);
});
- it('returns parsed value if response is empty', () => {
+ test('returns parsed value if response is empty', () => {
const response = {};
const sliceName = 'foobar';
@@ -105,7 +105,7 @@ describe('controlPanelUtil', () => {
expect(result[0].label).toEqual(sliceName);
});
- it('returns response options if no value is chosen', () => {
+ test('returns response options if no value is chosen', () => {
const sliceName1 = 'foo';
const sliceName2 = 'bar';
const response = {
@@ -131,7 +131,7 @@ describe('controlPanelUtil', () => {
expect(result[1].label).toEqual(sliceName2);
});
- it('returns correct result if id of chosen config does not exist in response', () => {
+ test('returns correct result if id of chosen config does not exist in response', () => {
const response = {
result: [
{
@@ -171,7 +171,7 @@ describe('controlPanelUtil', () => {
expect(threeDifferentIds).toEqual(true);
});
- it('returns correct result if id of chosen config already exists', () => {
+ test('returns correct result if id of chosen config already exists', () => {
const response = {
result: [
{
diff --git a/superset-frontend/plugins/plugin-chart-cartodiagram/test/util/geometryUtil.test.ts b/superset-frontend/plugins/plugin-chart-cartodiagram/test/util/geometryUtil.test.ts
index 4f070f4b783..a99892c96b7 100644
--- a/superset-frontend/plugins/plugin-chart-cartodiagram/test/util/geometryUtil.test.ts
+++ b/superset-frontend/plugins/plugin-chart-cartodiagram/test/util/geometryUtil.test.ts
@@ -26,7 +26,7 @@ import { ChartConfig } from '../../src/types';
describe('geometryUtil', () => {
describe('getProjectedCoordinateFromPointGeoJson', () => {
- it('returns a plausible result', () => {
+ test('returns a plausible result', () => {
const pointGeoJson: Point = {
type: 'Point',
coordinates: [6.6555, 49.74283],
@@ -42,7 +42,7 @@ describe('geometryUtil', () => {
});
describe('getExtentFromFeatures', () => {
- it('computes correct extent with valid input', () => {
+ test('computes correct extent with valid input', () => {
const expectedExtent = [1, 2, 3, 4];
const chartConfig: ChartConfig = {
@@ -94,7 +94,7 @@ describe('geometryUtil', () => {
expect(extent).toEqual(expectedExtent);
});
- it('returns undefined on invalid input', () => {
+ test('returns undefined on invalid input', () => {
const emptyExtent = getExtentFromFeatures([]);
expect(emptyExtent).toBeUndefined();
});
diff --git a/superset-frontend/plugins/plugin-chart-cartodiagram/test/util/layerUtil.test.ts b/superset-frontend/plugins/plugin-chart-cartodiagram/test/util/layerUtil.test.ts
index 20c415df655..05f63e9b8a5 100644
--- a/superset-frontend/plugins/plugin-chart-cartodiagram/test/util/layerUtil.test.ts
+++ b/superset-frontend/plugins/plugin-chart-cartodiagram/test/util/layerUtil.test.ts
@@ -27,14 +27,14 @@ import {
describe('layerUtil', () => {
describe('createWmsLayer', () => {
- it('exists', () => {
+ test('exists', () => {
// function is trivial
expect(createWmsLayer).toBeDefined();
});
});
describe('createWfsLayer', () => {
- it('properly applies style', async () => {
+ test('properly applies style', async () => {
const colorToExpect = '#123456';
const wfsLayerConf: WfsLayerConf = {
@@ -82,14 +82,14 @@ describe('layerUtil', () => {
});
describe('createXyzLayer', () => {
- it('exists', () => {
+ test('exists', () => {
// function is trivial
expect(createXyzLayer).toBeDefined();
});
});
describe('createLayer', () => {
- it('exists', () => {
+ test('exists', () => {
expect(createLayer).toBeDefined();
});
});
diff --git a/superset-frontend/plugins/plugin-chart-cartodiagram/test/util/mapUtil.test.ts b/superset-frontend/plugins/plugin-chart-cartodiagram/test/util/mapUtil.test.ts
index 0447b03afb8..ef5be1ce41a 100644
--- a/superset-frontend/plugins/plugin-chart-cartodiagram/test/util/mapUtil.test.ts
+++ b/superset-frontend/plugins/plugin-chart-cartodiagram/test/util/mapUtil.test.ts
@@ -26,7 +26,7 @@ import { fitMapToCharts } from '../../src/util/mapUtil';
describe('mapUtil', () => {
describe('fitMapToCharts', () => {
- it('changes the center of the map', () => {
+ test('changes the center of the map', () => {
const chartConfig: ChartConfig = {
type: 'FeatureCollection',
features: [
diff --git a/superset-frontend/plugins/plugin-chart-cartodiagram/test/util/serviceUtil.test.ts b/superset-frontend/plugins/plugin-chart-cartodiagram/test/util/serviceUtil.test.ts
index 0728839b92b..0f01664d8c1 100644
--- a/superset-frontend/plugins/plugin-chart-cartodiagram/test/util/serviceUtil.test.ts
+++ b/superset-frontend/plugins/plugin-chart-cartodiagram/test/util/serviceUtil.test.ts
@@ -22,22 +22,22 @@ import { isVersionBelow } from '../../src/util/serviceUtil';
describe('serviceUtil', () => {
describe('isVersionBelow', () => {
describe('WMS', () => {
- it('recognizes the higher version', () => {
+ test('recognizes the higher version', () => {
const result = isVersionBelow('1.3.0', '1.1.0', 'WMS');
expect(result).toEqual(false);
});
- it('recognizes the lower version', () => {
+ test('recognizes the lower version', () => {
const result = isVersionBelow('1.1.1', '1.3.0', 'WMS');
expect(result).toEqual(true);
});
});
describe('WFS', () => {
- it('recognizes the higher version', () => {
+ test('recognizes the higher version', () => {
const result = isVersionBelow('2.0.2', '1.1.0', 'WFS');
expect(result).toEqual(false);
});
- it('recognizes the lower version', () => {
+ test('recognizes the lower version', () => {
const result = isVersionBelow('1.1.0', '2.0.2', 'WFS');
expect(result).toEqual(true);
});
diff --git a/superset-frontend/plugins/plugin-chart-cartodiagram/test/util/transformPropsUtil.test.ts b/superset-frontend/plugins/plugin-chart-cartodiagram/test/util/transformPropsUtil.test.ts
index 6190990e0d7..4558b6b946d 100644
--- a/superset-frontend/plugins/plugin-chart-cartodiagram/test/util/transformPropsUtil.test.ts
+++ b/superset-frontend/plugins/plugin-chart-cartodiagram/test/util/transformPropsUtil.test.ts
@@ -44,14 +44,14 @@ describe('transformPropsUtil', () => {
};
describe('getGeojsonColumns', () => {
- it('gets the GeoJSON columns', () => {
+ test('gets the GeoJSON columns', () => {
const columns = ['foo', 'bar', geom1];
const result = getGeojsonColumns(columns);
expect(result).toHaveLength(1);
expect(result[0]).toEqual(2);
});
- it('gets multiple GeoJSON columns', () => {
+ test('gets multiple GeoJSON columns', () => {
const columns = ['foo', geom2, 'bar', geom1];
const result = getGeojsonColumns(columns);
expect(result).toHaveLength(2);
@@ -59,7 +59,7 @@ describe('transformPropsUtil', () => {
expect(result[1]).toEqual(3);
});
- it('returns empty array when no GeoJSON is included', () => {
+ test('returns empty array when no GeoJSON is included', () => {
const columns = ['foo', 'bar'];
const result = getGeojsonColumns(columns);
expect(result).toHaveLength(0);
@@ -67,13 +67,13 @@ describe('transformPropsUtil', () => {
});
describe('createColumnName', () => {
- it('creates a columns name', () => {
+ test('creates a columns name', () => {
const columns = ['foo', 'bar'];
const result = createColumnName(columns, []);
expect(result).toEqual('foo, bar');
});
- it('ignores items provided by ignoreIdx', () => {
+ test('ignores items provided by ignoreIdx', () => {
const columns = ['foo', 'bar', 'baz'];
const ignoreIdx = [1];
const result = createColumnName(columns, ignoreIdx);
@@ -82,7 +82,7 @@ describe('transformPropsUtil', () => {
});
describe('groupByLocationGenericX', () => {
- it('groups in the correct count of geometries', () => {
+ test('groups in the correct count of geometries', () => {
const result = groupByLocationGenericX(
groupedTimeseriesChartData,
groupedTimeseriesParams,
@@ -92,7 +92,7 @@ describe('transformPropsUtil', () => {
expect(countOfGeometries).toEqual(2);
});
- it('groups items by same geometry', () => {
+ test('groups items by same geometry', () => {
const result = groupByLocationGenericX(
groupedTimeseriesChartData,
groupedTimeseriesParams,
@@ -105,14 +105,14 @@ describe('transformPropsUtil', () => {
});
describe('groupByLocation', () => {
- it('groups in the correct count of geometries', () => {
+ test('groups in the correct count of geometries', () => {
const geometryColumn = 'geom';
const result = groupByLocation(nonTimeSeriesChartData, geometryColumn);
const countOfGeometries = Object.keys(result).length;
expect(countOfGeometries).toEqual(2);
});
- it('groups items by same geometry', () => {
+ test('groups items by same geometry', () => {
const geometryColumn = 'geom';
const result = groupByLocation(nonTimeSeriesChartData, geometryColumn);
const allGeom1 = result[geom1].length === 6;
@@ -122,7 +122,7 @@ describe('transformPropsUtil', () => {
});
describe('stripGeomFromColnamesAndTypes', () => {
- it('strips the geom from colnames with geom column', () => {
+ test('strips the geom from colnames with geom column', () => {
const queryData = {
colnames: ['foo', 'geom'],
coltypes: [0, 0],
@@ -134,7 +134,7 @@ describe('transformPropsUtil', () => {
});
});
- it('strips the geom from colnames with grouped columns', () => {
+ test('strips the geom from colnames with grouped columns', () => {
const queryData = {
colnames: ['foo', `bar, ${geom1}`],
coltypes: [0, 0],
@@ -146,7 +146,7 @@ describe('transformPropsUtil', () => {
});
});
- it('strips the geom from colnames with grouped columns without geom', () => {
+ test('strips the geom from colnames with grouped columns without geom', () => {
const queryData = {
colnames: ['foo', `bar, baz`],
coltypes: [0, 0],
@@ -160,7 +160,7 @@ describe('transformPropsUtil', () => {
});
describe('stripGeomColumnFromLabelMap', () => {
- it('strips the geom column from label_map', () => {
+ test('strips the geom column from label_map', () => {
const labelMap = {
[`apple, ${geom1}`]: ['apple', geom1],
[`${geom2}, lemon`]: [geom2, 'lemon'],
@@ -192,12 +192,12 @@ describe('transformPropsUtil', () => {
chartTransformer = jest.fn();
});
- it('calls the transformProps function for every location', () => {
+ test('calls the transformProps function for every location', () => {
getChartConfigs(pieChartConfig, geomColumn, chartProps, chartTransformer);
expect(chartTransformer).toHaveBeenCalledTimes(2);
});
- it('returns a geojson', () => {
+ test('returns a geojson', () => {
const result = getChartConfigs(
pieChartConfig,
geomColumn,
@@ -216,7 +216,7 @@ describe('transformPropsUtil', () => {
}),
);
});
- it('returns a feature for each location', () => {
+ test('returns a feature for each location', () => {
const result = getChartConfigs(
pieChartConfig,
geomColumn,
@@ -230,7 +230,7 @@ describe('transformPropsUtil', () => {
});
describe('parseSelectedChart', () => {
- it('parses the inline stringified JSON', () => {
+ test('parses the inline stringified JSON', () => {
const selectedChartObject = {
id: 278,
params:
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberTotal/controlPanel.test.ts b/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberTotal/controlPanel.test.ts
index 4be15b9e4bd..7d8e74156d4 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberTotal/controlPanel.test.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberTotal/controlPanel.test.ts
@@ -44,7 +44,7 @@ jest.mock('@superset-ui/chart-controls', () => {
});
describe('BigNumber Total Control Panel Config', () => {
- it('should have the required control panel sections', () => {
+ test('should have the required control panel sections', () => {
expect(controlPanel).toHaveProperty('controlPanelSections');
const sections = controlPanel.controlPanelSections;
expect(Array.isArray(sections)).toBe(true);
@@ -74,7 +74,7 @@ describe('BigNumber Total Control Panel Config', () => {
expect(conditionalFormattingRow).toBeTruthy();
});
- it('should have y_axis_format override with correct label', () => {
+ test('should have y_axis_format override with correct label', () => {
expect(controlPanel).toHaveProperty('controlOverrides');
expect(controlPanel.controlOverrides).toHaveProperty('y_axis_format');
expect(controlPanel.controlOverrides!.y_axis_format!.label).toBe(
@@ -82,7 +82,7 @@ describe('BigNumber Total Control Panel Config', () => {
);
});
- it('should override formData metric using getStandardizedControls', () => {
+ test('should override formData metric using getStandardizedControls', () => {
const dummyFormData = { someProp: 'test' } as unknown as SqlaFormData;
const newFormData = controlPanel.formDataOverrides!(dummyFormData);
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberTotal/transformProps.test.ts b/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberTotal/transformProps.test.ts
index 5625da29e28..76a3cbde936 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberTotal/transformProps.test.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberTotal/transformProps.test.ts
@@ -66,7 +66,7 @@ describe('BigNumberTotal transformProps', () => {
const baseRawFormData = { dummy: 'raw' };
- it('should return null bigNumber when no data is provided', () => {
+ test('should return null bigNumber when no data is provided', () => {
const chartProps = {
width: 400,
height: 300,
@@ -91,7 +91,7 @@ describe('BigNumberTotal transformProps', () => {
// colorThresholdFormatters fallback to empty array when getColorFormatters returns falsy
expect(result.colorThresholdFormatters).toEqual([]);
});
- it('should convert subheader to subtitle', () => {
+ test('should convert subheader to subtitle', () => {
const chartProps = {
width: 400,
height: 300,
@@ -120,7 +120,7 @@ describe('BigNumberTotal transformProps', () => {
},
};
- it('uses subtitle font size when subtitle is provided', () => {
+ test('uses subtitle font size when subtitle is provided', () => {
const result = transformProps({
...baseChartProps,
formData: {
@@ -139,7 +139,7 @@ describe('BigNumberTotal transformProps', () => {
expect(result.subtitleFontSize).toBe(0.4);
});
- it('should compute bigNumber using parseMetricValue when data exists', () => {
+ test('should compute bigNumber using parseMetricValue when data exists', () => {
const chartProps = {
width: 500,
height: 400,
@@ -160,7 +160,7 @@ describe('BigNumberTotal transformProps', () => {
expect(result.bigNumber).toEqual(456);
});
- it('should use formatTime as headerFormatter for Temporal or String types or forced formatting', () => {
+ test('should use formatTime as headerFormatter for Temporal or String types or forced formatting', () => {
// Case 1: Temporal type
const chartPropsTemporal = {
width: 600,
@@ -214,7 +214,7 @@ describe('BigNumberTotal transformProps', () => {
expect(resultForced.headerFormatter(5)).toBe('5pm');
});
- it('should use numberFormatter as headerFormatter when not Temporal/String and no forced formatting', () => {
+ test('should use numberFormatter as headerFormatter when not Temporal/String and no forced formatting', () => {
const chartProps = {
width: 700,
height: 500,
@@ -231,7 +231,7 @@ describe('BigNumberTotal transformProps', () => {
expect(result.headerFormatter(500)).toBe('$500');
});
- it('should propagate colorThresholdFormatters from getColorFormatters', () => {
+ test('should propagate colorThresholdFormatters from getColorFormatters', () => {
// Override the getColorFormatters mock to return specific value
const mockFormatters = [{ formatter: 'red' }];
(getColorFormatters as jest.Mock).mockReturnValueOnce(mockFormatters);
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberWithTrendline/buildQuery.test.ts b/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberWithTrendline/buildQuery.test.ts
index 4e2fc1871e6..0ce7743b362 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberWithTrendline/buildQuery.test.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberWithTrendline/buildQuery.test.ts
@@ -49,7 +49,7 @@ describe('BigNumberWithTrendline buildQuery', () => {
aggregation: null,
};
- it('creates raw metric query when aggregation is "raw"', () => {
+ test('creates raw metric query when aggregation is "raw"', () => {
const queryContext = buildQuery({ ...baseFormData, aggregation: 'raw' });
const bigNumberQuery = queryContext.queries[1];
@@ -58,7 +58,7 @@ describe('BigNumberWithTrendline buildQuery', () => {
expect(bigNumberQuery.columns).toEqual([]);
});
- it('returns single query for aggregation methods that can be computed client-side', () => {
+ test('returns single query for aggregation methods that can be computed client-side', () => {
const queryContext = buildQuery({ ...baseFormData, aggregation: 'sum' });
expect(queryContext.queries.length).toBe(1);
@@ -70,7 +70,7 @@ describe('BigNumberWithTrendline buildQuery', () => {
]);
});
- it('returns single query for LAST_VALUE aggregation', () => {
+ test('returns single query for LAST_VALUE aggregation', () => {
const queryContext = buildQuery({
...baseFormData,
aggregation: 'LAST_VALUE',
@@ -85,7 +85,7 @@ describe('BigNumberWithTrendline buildQuery', () => {
]);
});
- it('returns two queries only for raw aggregation', () => {
+ test('returns two queries only for raw aggregation', () => {
const queryContext = buildQuery({ ...baseFormData, aggregation: 'raw' });
expect(queryContext.queries.length).toBe(2);
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberWithTrendline/transformProps.test.ts b/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberWithTrendline/transformProps.test.ts
index b4be8637bd6..aa0dcdcb6b0 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberWithTrendline/transformProps.test.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberWithTrendline/transformProps.test.ts
@@ -123,7 +123,7 @@ describe('BigNumberWithTrendline transformProps', () => {
const baseHooks = { onContextMenu };
const baseRawFormData = { dummy: 'raw' };
- it('should return null bigNumber when no data is provided', () => {
+ test('should return null bigNumber when no data is provided', () => {
const chartProps = {
width: 400,
height: 300,
@@ -142,7 +142,7 @@ describe('BigNumberWithTrendline transformProps', () => {
expect(result.subtitle).toBe('subtitle message');
});
- it('should calculate subheader as percent change with suffix', () => {
+ test('should calculate subheader as percent change with suffix', () => {
const chartProps = {
width: 500,
height: 400,
@@ -169,7 +169,7 @@ describe('BigNumberWithTrendline transformProps', () => {
expect(result.subheader).toBe('10.0% WoW');
});
- it('should compute bigNumber from parseMetricValue', () => {
+ test('should compute bigNumber from parseMetricValue', () => {
const chartProps = {
width: 600,
height: 450,
@@ -195,7 +195,7 @@ describe('BigNumberWithTrendline transformProps', () => {
expect(result.bigNumber).toEqual(456);
});
- it('should use formatTime as headerFormatter for Temporal/String or forced', () => {
+ test('should use formatTime as headerFormatter for Temporal/String or forced', () => {
const formData = { ...baseFormData, forceTimestampFormatting: true };
const chartProps = {
width: 600,
@@ -222,7 +222,7 @@ describe('BigNumberWithTrendline transformProps', () => {
expect(result.headerFormatter(5)).toBe('5pm');
});
- it('should use numberFormatter when not Temporal/String and not forced', () => {
+ test('should use numberFormatter when not Temporal/String and not forced', () => {
const formData = { ...baseFormData, forceTimestampFormatting: false };
const chartProps = {
width: 600,
@@ -247,7 +247,7 @@ describe('BigNumberWithTrendline transformProps', () => {
expect(result.headerFormatter.format(500)).toBe('$500');
});
- it('should use last data point for comparison when big number comes from aggregated data', () => {
+ test('should use last data point for comparison when big number comes from aggregated data', () => {
const chartProps = {
width: 500,
height: 400,
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.test.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.test.tsx
index 89a0269dce6..b290596d153 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.test.tsx
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/Timeseries/EchartsTimeseries.test.tsx
@@ -43,9 +43,8 @@ const mockEchart = jest.fn();
jest.mock('../components/Echart', () => {
const { forwardRef } = jest.requireActual('react');
const MockEchart = forwardRef(
- (props, ref) => {
+ (props, _ref) => {
mockEchart(props);
- void ref;
return null;
},
);
@@ -227,9 +226,7 @@ test('observes extra control height changes when ResizeObserver is available', a
observeSpy(target);
};
- unobserve(_target: Element): void {
- void _target;
- }
+ unobserve(_target: Element): void {}
disconnect = () => {
disconnectSpy();
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/utils/themeOverrides.test.ts b/superset-frontend/plugins/plugin-chart-echarts/src/utils/themeOverrides.test.ts
index 5cf6bbd01a4..931f026cb5f 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/utils/themeOverrides.test.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/utils/themeOverrides.test.ts
@@ -19,7 +19,7 @@
import { mergeReplaceArrays } from '@superset-ui/core';
describe('Theme Override Deep Merge Behavior', () => {
- it('should merge nested objects correctly', () => {
+ test('should merge nested objects correctly', () => {
const baseOptions = {
grid: {
left: '5%',
@@ -67,7 +67,7 @@ describe('Theme Override Deep Merge Behavior', () => {
});
});
- it('should replace arrays instead of merging them', () => {
+ test('should replace arrays instead of merging them', () => {
const baseOptions = {
series: [
{ name: 'Series 1', type: 'line' },
@@ -86,7 +86,7 @@ describe('Theme Override Deep Merge Behavior', () => {
expect(result.series).toHaveLength(1);
});
- it('should handle null overrides correctly', () => {
+ test('should handle null overrides correctly', () => {
const baseOptions = {
grid: {
left: '5%',
@@ -127,7 +127,7 @@ describe('Theme Override Deep Merge Behavior', () => {
});
});
- it('should handle override precedence correctly', () => {
+ test('should handle override precedence correctly', () => {
const baseTheme = {
textStyle: { color: '#000', fontSize: 12 },
};
@@ -167,7 +167,7 @@ describe('Theme Override Deep Merge Behavior', () => {
});
});
- it('should preserve deep nested structures', () => {
+ test('should preserve deep nested structures', () => {
const baseOptions = {
xAxis: {
axisLabel: {
@@ -215,7 +215,7 @@ describe('Theme Override Deep Merge Behavior', () => {
});
});
- it('should handle function values correctly', () => {
+ test('should handle function values correctly', () => {
const formatFunction = (value: any) => `${value}%`;
const overrideFunction = (value: any) => `$${value}`;
@@ -241,7 +241,7 @@ describe('Theme Override Deep Merge Behavior', () => {
expect(result.yAxis.axisLabel.formatter('100')).toBe('$100');
});
- it('should handle empty objects and arrays', () => {
+ test('should handle empty objects and arrays', () => {
const baseOptions = {
series: [{ name: 'Test', data: [1, 2, 3] }],
grid: { left: '5%' },
diff --git a/superset-frontend/plugins/plugin-chart-echarts/test/BigNumber/transformProps.test.ts b/superset-frontend/plugins/plugin-chart-echarts/test/BigNumber/transformProps.test.ts
index 40f1b87fd43..3c681f281b0 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/test/BigNumber/transformProps.test.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/test/BigNumber/transformProps.test.ts
@@ -119,7 +119,7 @@ describe('BigNumberWithTrendline', () => {
);
describe('transformProps()', () => {
- it('should fallback and format time', () => {
+ test('should fallback and format time', () => {
const transformed = transformProps(props);
// the first item is the last item sorted by __timestamp
const lastDatum = transformed.trendLineData?.pop();
@@ -140,7 +140,7 @@ describe('BigNumberWithTrendline', () => {
);
});
- it('should respect datasource d3 format', () => {
+ test('should respect datasource d3 format', () => {
const propsWithDatasource = {
...props,
datasource: {
@@ -162,7 +162,7 @@ describe('BigNumberWithTrendline', () => {
);
});
- it('should format with datasource currency', () => {
+ test('should format with datasource currency', () => {
const propsWithDatasource = {
...props,
datasource: {
@@ -188,7 +188,7 @@ describe('BigNumberWithTrendline', () => {
);
});
- it('should show X axis when showXAxis is true', () => {
+ test('should show X axis when showXAxis is true', () => {
const transformed = transformProps({
...props,
formData: {
@@ -199,7 +199,7 @@ describe('BigNumberWithTrendline', () => {
expect((transformed.echartOptions?.xAxis as any).show).toBe(true);
});
- it('should not show X axis when showXAxis is false', () => {
+ test('should not show X axis when showXAxis is false', () => {
const transformed = transformProps({
...props,
formData: {
@@ -210,7 +210,7 @@ describe('BigNumberWithTrendline', () => {
expect((transformed.echartOptions?.xAxis as any).show).toBe(false);
});
- it('should show Y axis when showYAxis is true', () => {
+ test('should show Y axis when showYAxis is true', () => {
const transformed = transformProps({
...props,
formData: {
@@ -221,7 +221,7 @@ describe('BigNumberWithTrendline', () => {
expect((transformed.echartOptions?.yAxis as any).show).toBe(true);
});
- it('should not show Y axis when showYAxis is false', () => {
+ test('should not show Y axis when showYAxis is false', () => {
const transformed = transformProps({
...props,
formData: {
@@ -233,7 +233,7 @@ describe('BigNumberWithTrendline', () => {
});
});
- it('should respect min/max label visibility settings', () => {
+ test('should respect min/max label visibility settings', () => {
const transformed = transformProps({
...props,
formData: {
@@ -251,7 +251,7 @@ describe('BigNumberWithTrendline', () => {
expect(yAxis.axisLabel.showMaxLabel).toBe(true);
});
- it('should use minimal grid when both axes are hidden', () => {
+ test('should use minimal grid when both axes are hidden', () => {
const transformed = transformProps({
...props,
formData: {
@@ -269,7 +269,7 @@ describe('BigNumberWithTrendline', () => {
});
});
- it('should use expanded grid when either axis is shown', () => {
+ test('should use expanded grid when either axis is shown', () => {
const expandedGrid = {
containLabel: true,
bottom: TIMESERIES_CONSTANTS.gridOffsetBottom,
@@ -365,7 +365,7 @@ describe('BigNumberWithTrendline - Aggregation Tests', () => {
],
} as unknown as BigNumberWithTrendlineChartProps;
- it('should correctly calculate SUM', () => {
+ test('should correctly calculate SUM', () => {
const props = {
...baseProps,
formData: { ...baseProps.formData, aggregation: 'sum' },
@@ -383,7 +383,7 @@ describe('BigNumberWithTrendline - Aggregation Tests', () => {
expect(transformed.bigNumber).toStrictEqual(150);
});
- it('should correctly calculate AVG', () => {
+ test('should correctly calculate AVG', () => {
const props = {
...baseProps,
formData: { ...baseProps.formData, aggregation: 'mean' },
@@ -401,7 +401,7 @@ describe('BigNumberWithTrendline - Aggregation Tests', () => {
expect(transformed.bigNumber).toStrictEqual(37.5);
});
- it('should correctly calculate MIN', () => {
+ test('should correctly calculate MIN', () => {
const props = {
...baseProps,
formData: { ...baseProps.formData, aggregation: 'min' },
@@ -419,7 +419,7 @@ describe('BigNumberWithTrendline - Aggregation Tests', () => {
expect(transformed.bigNumber).toStrictEqual(10);
});
- it('should correctly calculate MAX', () => {
+ test('should correctly calculate MAX', () => {
const props = {
...baseProps,
formData: { ...baseProps.formData, aggregation: 'max' },
@@ -437,7 +437,7 @@ describe('BigNumberWithTrendline - Aggregation Tests', () => {
expect(transformed.bigNumber).toStrictEqual(60);
});
- it('should correctly calculate MEDIAN (odd count)', () => {
+ test('should correctly calculate MEDIAN (odd count)', () => {
const oddCountProps = {
...baseProps,
queriesData: [
@@ -472,7 +472,7 @@ describe('BigNumberWithTrendline - Aggregation Tests', () => {
expect(transformed.bigNumber).toStrictEqual(30);
});
- it('should correctly calculate MEDIAN (even count)', () => {
+ test('should correctly calculate MEDIAN (even count)', () => {
const props = {
...propsWithEvenData,
formData: { ...propsWithEvenData.formData, aggregation: 'median' },
@@ -490,7 +490,7 @@ describe('BigNumberWithTrendline - Aggregation Tests', () => {
expect(transformed.bigNumber).toStrictEqual(25);
});
- it('should return the LAST_VALUE correctly', () => {
+ test('should return the LAST_VALUE correctly', () => {
const transformed = transformProps(baseProps);
expect(transformed.bigNumber).toStrictEqual(10);
});
diff --git a/superset-frontend/plugins/plugin-chart-echarts/test/BoxPlot/buildQuery.test.ts b/superset-frontend/plugins/plugin-chart-echarts/test/BoxPlot/buildQuery.test.ts
index 0d0f2f83899..e7633e421a4 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/test/BoxPlot/buildQuery.test.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/test/BoxPlot/buildQuery.test.ts
@@ -38,7 +38,7 @@ describe('BoxPlot buildQuery', () => {
yAxisFormat: 'SMART_NUMBER',
};
- it('should build timeseries when series columns is empty', () => {
+ test('should build timeseries when series columns is empty', () => {
const queryContext = buildQuery(formData);
const [query] = queryContext.queries;
expect(query.metrics).toEqual(['foo']);
@@ -49,7 +49,7 @@ describe('BoxPlot buildQuery', () => {
expect((rule as PostProcessingBoxplot)?.options?.groupby).toEqual(['bar']);
});
- it('should build non-timeseries query object when columns is defined', () => {
+ test('should build non-timeseries query object when columns is defined', () => {
const queryContext = buildQuery({ ...formData, columns: ['qwerty'] });
const [query] = queryContext.queries;
expect(query.metrics).toEqual(['foo']);
diff --git a/superset-frontend/plugins/plugin-chart-echarts/test/BoxPlot/transformProps.test.ts b/superset-frontend/plugins/plugin-chart-echarts/test/BoxPlot/transformProps.test.ts
index 95f997d3976..13cbbd78a00 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/test/BoxPlot/transformProps.test.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/test/BoxPlot/transformProps.test.ts
@@ -71,7 +71,7 @@ describe('BoxPlot transformProps', () => {
theme: supersetTheme,
});
- it('should transform chart props for viz', () => {
+ test('should transform chart props for viz', () => {
expect(transformProps(chartProps as EchartsBoxPlotChartProps)).toEqual(
expect.objectContaining({
width: 800,
diff --git a/superset-frontend/plugins/plugin-chart-echarts/test/Bubble/buildQuery.test.ts b/superset-frontend/plugins/plugin-chart-echarts/test/Bubble/buildQuery.test.ts
index cbe6003eb4f..05a617b2365 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/test/Bubble/buildQuery.test.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/test/Bubble/buildQuery.test.ts
@@ -42,7 +42,7 @@ describe('Bubble buildQuery', () => {
},
};
- it('Should build query without dimension', () => {
+ test('Should build query without dimension', () => {
const queryContext = buildQuery(formData);
const [query] = queryContext.queries;
expect(query.columns).toEqual(['customer_name']);
@@ -66,7 +66,7 @@ describe('Bubble buildQuery', () => {
},
]);
});
- it('Should build query with dimension', () => {
+ test('Should build query with dimension', () => {
const queryContext = buildQuery({ ...formData, series: 'state' });
const [query] = queryContext.queries;
expect(query.columns).toEqual(['customer_name', 'state']);
diff --git a/superset-frontend/plugins/plugin-chart-echarts/test/Bubble/transformProps.test.ts b/superset-frontend/plugins/plugin-chart-echarts/test/Bubble/transformProps.test.ts
index 8ff8306d4cc..da66802c4e8 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/test/Bubble/transformProps.test.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/test/Bubble/transformProps.test.ts
@@ -85,7 +85,7 @@ const chartConfig: ChartPropsConfig = {
};
describe('Bubble transformProps', () => {
- it('Should transform props for viz', () => {
+ test('Should transform props for viz', () => {
const chartProps = new ChartProps(chartConfig);
expect(transformProps(chartProps as EchartsBubbleChartProps)).toEqual(
expect.objectContaining({
@@ -114,7 +114,7 @@ describe('Bubble transformProps', () => {
);
});
- it('Should transform props with undefined control values', () => {
+ test('Should transform props with undefined control values', () => {
const formData: SqlaFormData = {
...defaultFormData,
xAxisBounds: undefined,
@@ -157,7 +157,7 @@ describe('Bubble formatTooltip', () => {
const dollerFormatter = getNumberFormatter('$,.2f');
const percentFormatter = getNumberFormatter(',.1%');
- it('Should generate correct bubble label content with dimension', () => {
+ test('Should generate correct bubble label content with dimension', () => {
const params = {
data: [10000, 20000, 3, 'bubble title', 'bubble dimension'],
};
@@ -180,7 +180,7 @@ describe('Bubble formatTooltip', () => {
expect(html).toContain('$20,000.00');
expect(html).toContain('300.0%');
});
- it('Should generate correct bubble label content without dimension', () => {
+ test('Should generate correct bubble label content without dimension', () => {
const params = {
data: [10000, 25000, 3, 'bubble title', null],
};
@@ -213,7 +213,7 @@ describe('legend sorting', () => {
...overrides,
},
});
- it('preserves original data order when no sort specified', () => {
+ test('preserves original data order when no sort specified', () => {
const props = createChartProps({ legendSort: null });
const result = transformProps(props as EchartsBubbleChartProps);
@@ -225,7 +225,7 @@ describe('legend sorting', () => {
]);
});
- it('sorts alphabetically ascending when legendSort is "asc"', () => {
+ test('sorts alphabetically ascending when legendSort is "asc"', () => {
const props = createChartProps({ legendSort: 'asc' });
const result = transformProps(props as EchartsBubbleChartProps);
@@ -237,7 +237,7 @@ describe('legend sorting', () => {
]);
});
- it('sorts alphabetically descending when legendSort is "desc"', () => {
+ test('sorts alphabetically descending when legendSort is "desc"', () => {
const props = createChartProps({ legendSort: 'desc' });
const result = transformProps(props as EchartsBubbleChartProps);
diff --git a/superset-frontend/plugins/plugin-chart-echarts/test/Funnel/buildQuery.test.ts b/superset-frontend/plugins/plugin-chart-echarts/test/Funnel/buildQuery.test.ts
index 09a5974537a..6d63513a35f 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/test/Funnel/buildQuery.test.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/test/Funnel/buildQuery.test.ts
@@ -27,7 +27,7 @@ describe('Funnel buildQuery', () => {
viz_type: 'my_chart',
};
- it('should build query fields from form data', () => {
+ test('should build query fields from form data', () => {
const queryContext = buildQuery(formData);
const [query] = queryContext.queries;
expect(query.metrics).toEqual(['foo']);
diff --git a/superset-frontend/plugins/plugin-chart-echarts/test/Funnel/transformProps.test.ts b/superset-frontend/plugins/plugin-chart-echarts/test/Funnel/transformProps.test.ts
index 4e3990230a9..3987bbc6483 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/test/Funnel/transformProps.test.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/test/Funnel/transformProps.test.ts
@@ -48,7 +48,7 @@ const chartProps = new ChartProps({
});
describe('Funnel transformProps', () => {
- it('should transform chart props for viz', () => {
+ test('should transform chart props for viz', () => {
expect(transformProps(chartProps as EchartsFunnelChartProps)).toEqual(
expect.objectContaining({
width: 800,
@@ -75,7 +75,7 @@ describe('Funnel transformProps', () => {
});
describe('formatFunnelLabel', () => {
- it('should generate a valid funnel chart label', () => {
+ test('should generate a valid funnel chart label', () => {
const numberFormatter = getNumberFormatter();
const params = {
name: 'My Label',
@@ -143,7 +143,7 @@ describe('legend sorting', () => {
queriesData: legendQueriesData,
});
- it('preserves original data order when no sort specified', () => {
+ test('preserves original data order when no sort specified', () => {
const props = createChartProps({ legendSort: null });
const result = transformProps(props as EchartsFunnelChartProps);
@@ -151,7 +151,7 @@ describe('legend sorting', () => {
expect(legendData).toEqual(['Sylvester', 'Arnold', 'Mark']);
});
- it('sorts alphabetically ascending when legendSort is "asc"', () => {
+ test('sorts alphabetically ascending when legendSort is "asc"', () => {
const props = createChartProps({ legendSort: 'asc' });
const result = transformProps(props as EchartsFunnelChartProps);
@@ -159,7 +159,7 @@ describe('legend sorting', () => {
expect(legendData).toEqual(['Arnold', 'Mark', 'Sylvester']);
});
- it('sorts alphabetically descending when legendSort is "desc"', () => {
+ test('sorts alphabetically descending when legendSort is "desc"', () => {
const props = createChartProps({ legendSort: 'desc' });
const result = transformProps(props as EchartsFunnelChartProps);
diff --git a/superset-frontend/plugins/plugin-chart-echarts/test/Gantt/buildQuery.test.ts b/superset-frontend/plugins/plugin-chart-echarts/test/Gantt/buildQuery.test.ts
index cae9de79bb8..f8aa7c41ba2 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/test/Gantt/buildQuery.test.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/test/Gantt/buildQuery.test.ts
@@ -39,7 +39,7 @@ describe('Gantt buildQuery', () => {
],
};
- it('should build query', () => {
+ test('should build query', () => {
const queryContext = buildQuery(formData);
const [query] = queryContext.queries;
expect(query.metrics).toStrictEqual(['tooltip_metric']);
diff --git a/superset-frontend/plugins/plugin-chart-echarts/test/Gantt/transformProps.test.ts b/superset-frontend/plugins/plugin-chart-echarts/test/Gantt/transformProps.test.ts
index 3eaf7bf576b..759e5eb43d0 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/test/Gantt/transformProps.test.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/test/Gantt/transformProps.test.ts
@@ -86,7 +86,7 @@ const chartPropsConfig = {
};
describe('Gantt transformProps', () => {
- it('should transform chart props', () => {
+ test('should transform chart props', () => {
const chartProps = new ChartProps(chartPropsConfig);
const transformedProps = transformProps(
chartProps as EchartsGanttChartProps,
@@ -280,7 +280,7 @@ describe('legend sorting', () => {
},
});
- it('preserves original data order when no sort specified', () => {
+ test('preserves original data order when no sort specified', () => {
const props = createChartProps({ legendSort: null });
const result = transformProps(props as EchartsGanttChartProps);
@@ -288,7 +288,7 @@ describe('legend sorting', () => {
expect(legendData).toEqual(['series value 1', 'series value 2']);
});
- it('sorts alphabetically ascending when legendSort is "asc"', () => {
+ test('sorts alphabetically ascending when legendSort is "asc"', () => {
const props = createChartProps({ legendSort: 'asc' });
const result = transformProps(props as EchartsGanttChartProps);
@@ -296,7 +296,7 @@ describe('legend sorting', () => {
expect(legendData).toEqual(['series value 1', 'series value 2']);
});
- it('sorts alphabetically descending when legendSort is "desc"', () => {
+ test('sorts alphabetically descending when legendSort is "desc"', () => {
const props = createChartProps({ legendSort: 'desc' });
const result = transformProps(props as EchartsGanttChartProps);
diff --git a/superset-frontend/plugins/plugin-chart-echarts/test/Gauge/buildQuery.test.ts b/superset-frontend/plugins/plugin-chart-echarts/test/Gauge/buildQuery.test.ts
index 7eb975dafec..b85e934beb2 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/test/Gauge/buildQuery.test.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/test/Gauge/buildQuery.test.ts
@@ -25,21 +25,21 @@ describe('Gauge buildQuery', () => {
viz_type: 'my_chart',
};
- it('should build query fields with no group by column', () => {
+ test('should build query fields with no group by column', () => {
const formData = { ...baseFormData, groupby: undefined };
const queryContext = buildQuery(formData);
const [query] = queryContext.queries;
expect(query.columns).toEqual([]);
});
- it('should build query fields with single group by column', () => {
+ test('should build query fields with single group by column', () => {
const formData = { ...baseFormData, groupby: ['foo'] };
const queryContext = buildQuery(formData);
const [query] = queryContext.queries;
expect(query.columns).toEqual(['foo']);
});
- it('should build query fields with multiple group by columns', () => {
+ test('should build query fields with multiple group by columns', () => {
const formData = { ...baseFormData, groupby: ['foo', 'bar'] };
const queryContext = buildQuery(formData);
const [query] = queryContext.queries;
diff --git a/superset-frontend/plugins/plugin-chart-echarts/test/Gauge/transformProps.test.ts b/superset-frontend/plugins/plugin-chart-echarts/test/Gauge/transformProps.test.ts
index 2601464e5ca..945938a1af9 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/test/Gauge/transformProps.test.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/test/Gauge/transformProps.test.ts
@@ -53,7 +53,7 @@ describe('Echarts Gauge transformProps', () => {
roundCap: false,
};
- it('should transform chart props for no group by column', () => {
+ test('should transform chart props for no group by column', () => {
const formData: SqlaFormData = { ...baseFormData, groupby: [] };
const queriesData = [
{
@@ -95,7 +95,7 @@ describe('Echarts Gauge transformProps', () => {
expect(seriesData[0].detail.fontSize).toBe(16.8);
});
- it('should transform chart props for single group by column', () => {
+ test('should transform chart props for single group by column', () => {
const formData: SqlaFormData = {
...baseFormData,
groupby: ['year'],
@@ -154,7 +154,7 @@ describe('Echarts Gauge transformProps', () => {
expect(seriesData[1].detail.fontSize).toBe(16.8);
});
- it('should transform chart props for multiple group by columns', () => {
+ test('should transform chart props for multiple group by columns', () => {
const formData: SqlaFormData = {
...baseFormData,
groupby: ['year', 'platform'],
@@ -215,7 +215,7 @@ describe('Echarts Gauge transformProps', () => {
expect(seriesData[1].detail.fontSize).toBe(16.8);
});
- it('should transform chart props for intervals', () => {
+ test('should transform chart props for intervals', () => {
const formData: SqlaFormData = {
...baseFormData,
groupby: ['year', 'platform'],
@@ -305,7 +305,7 @@ describe('Min/Max calculation and axis labels', () => {
groupby: [],
};
- it('should use provided minVal and maxVal when valid numbers', () => {
+ test('should use provided minVal and maxVal when valid numbers', () => {
const formData: SqlaFormData = {
...baseFormData,
minVal: 10,
@@ -333,7 +333,7 @@ describe('Min/Max calculation and axis labels', () => {
expect(series.max).toBe(100);
});
- it('should calculate min/max from data when minVal is null', () => {
+ test('should calculate min/max from data when minVal is null', () => {
const formData: SqlaFormData = {
...baseFormData,
minVal: null,
@@ -361,7 +361,7 @@ describe('Min/Max calculation and axis labels', () => {
expect(series.max).toBe(100);
});
- it('should calculate min/max from data when maxVal is null', () => {
+ test('should calculate min/max from data when maxVal is null', () => {
const formData: SqlaFormData = {
...baseFormData,
minVal: 0,
@@ -389,7 +389,7 @@ describe('Min/Max calculation and axis labels', () => {
expect(series.max).toBe(160);
});
- it('should calculate min/max from data when both are null', () => {
+ test('should calculate min/max from data when both are null', () => {
const formData: SqlaFormData = {
...baseFormData,
minVal: null,
@@ -417,7 +417,7 @@ describe('Min/Max calculation and axis labels', () => {
expect(series.max).toBe(90);
});
- it('should calculate min/max from data when minVal is empty string', () => {
+ test('should calculate min/max from data when minVal is empty string', () => {
const formData: SqlaFormData = {
...baseFormData,
minVal: '' as any,
@@ -445,7 +445,7 @@ describe('Min/Max calculation and axis labels', () => {
expect(series.max).toBe(200);
});
- it('should calculate min/max from data when maxVal is invalid string', () => {
+ test('should calculate min/max from data when maxVal is invalid string', () => {
const formData: SqlaFormData = {
...baseFormData,
minVal: 0,
@@ -473,7 +473,7 @@ describe('Min/Max calculation and axis labels', () => {
expect(series.max).toBe(150);
});
- it('should handle negative values in min/max calculation', () => {
+ test('should handle negative values in min/max calculation', () => {
const formData: SqlaFormData = {
...baseFormData,
minVal: null,
@@ -501,7 +501,7 @@ describe('Min/Max calculation and axis labels', () => {
expect(series.max).toBe(80);
});
- it('should generate axis labels correctly based on min, max, and splitNumber', () => {
+ test('should generate axis labels correctly based on min, max, and splitNumber', () => {
const formData: SqlaFormData = {
...baseFormData,
minVal: 0,
@@ -533,7 +533,7 @@ describe('Min/Max calculation and axis labels', () => {
expect(series.axisLabel.formatter).toBeDefined();
});
- it('should calculate axis label length correctly for different number formats', () => {
+ test('should calculate axis label length correctly for different number formats', () => {
const formData: SqlaFormData = {
...baseFormData,
minVal: 0,
@@ -564,7 +564,7 @@ describe('Min/Max calculation and axis labels', () => {
expect(typeof series.axisLabel.formatter).toBe('function');
});
- it('should integrate interval bounds and colors with calculated min/max', () => {
+ test('should integrate interval bounds and colors with calculated min/max', () => {
const formData: SqlaFormData = {
...baseFormData,
minVal: null,
@@ -601,7 +601,7 @@ describe('Min/Max calculation and axis labels', () => {
);
});
- it('should handle zero values in data correctly', () => {
+ test('should handle zero values in data correctly', () => {
const formData: SqlaFormData = {
...baseFormData,
minVal: null,
@@ -629,7 +629,7 @@ describe('Min/Max calculation and axis labels', () => {
expect(series.max).toBe(0);
});
- it('should handle string minVal/maxVal that can be converted to numbers', () => {
+ test('should handle string minVal/maxVal that can be converted to numbers', () => {
const formData: SqlaFormData = {
...baseFormData,
minVal: '10' as any,
@@ -657,7 +657,7 @@ describe('Min/Max calculation and axis labels', () => {
expect(series.max).toBe(200);
});
- it('should handle different splitNumber values', () => {
+ test('should handle different splitNumber values', () => {
const formData: SqlaFormData = {
...baseFormData,
minVal: 0,
@@ -687,7 +687,7 @@ describe('Min/Max calculation and axis labels', () => {
});
describe('getIntervalBoundsAndColors', () => {
- it('should generate correct interval bounds and colors', () => {
+ test('should generate correct interval bounds and colors', () => {
const colorFn = CategoricalColorNamespace.getScale(
'supersetColors' as string,
);
diff --git a/superset-frontend/plugins/plugin-chart-echarts/test/Graph/buildQuery.test.ts b/superset-frontend/plugins/plugin-chart-echarts/test/Graph/buildQuery.test.ts
index b8471c4d933..588f2f41991 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/test/Graph/buildQuery.test.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/test/Graph/buildQuery.test.ts
@@ -28,7 +28,7 @@ describe('Graph buildQuery', () => {
viz_type: 'my_chart',
};
- it('should build groupby with source and target categories', () => {
+ test('should build groupby with source and target categories', () => {
const formDataWithCategories = {
...formData,
source: 'dummy_source',
@@ -47,7 +47,7 @@ describe('Graph buildQuery', () => {
expect(query.metrics).toEqual(['foo', 'bar']);
});
- it('should build groupby with source category', () => {
+ test('should build groupby with source category', () => {
const formDataWithCategories = {
...formData,
source: 'dummy_source',
@@ -64,7 +64,7 @@ describe('Graph buildQuery', () => {
expect(query.metrics).toEqual(['foo', 'bar']);
});
- it('should build groupby with target category', () => {
+ test('should build groupby with target category', () => {
const formDataWithCategories = {
...formData,
source: 'dummy_source',
@@ -81,7 +81,7 @@ describe('Graph buildQuery', () => {
expect(query.metrics).toEqual(['foo', 'bar']);
});
- it('should build groupby without any category', () => {
+ test('should build groupby without any category', () => {
const formDataWithCategories = {
...formData,
source: 'dummy_source',
diff --git a/superset-frontend/plugins/plugin-chart-echarts/test/Graph/transformProps.test.ts b/superset-frontend/plugins/plugin-chart-echarts/test/Graph/transformProps.test.ts
index e7c8b3ada99..50057ae148a 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/test/Graph/transformProps.test.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/test/Graph/transformProps.test.ts
@@ -58,7 +58,7 @@ const chartPropsConfig = {
};
describe('EchartsGraph transformProps', () => {
- it('should transform chart props for viz without category', () => {
+ test('should transform chart props for viz without category', () => {
const chartProps = new ChartProps(chartPropsConfig);
expect(transformProps(chartProps as EchartsGraphChartProps)).toEqual(
expect.objectContaining({
@@ -169,7 +169,7 @@ describe('EchartsGraph transformProps', () => {
);
});
- it('should transform chart props for viz with category and falsy normalization', () => {
+ test('should transform chart props for viz with category and falsy normalization', () => {
const formData: SqlaFormData = {
colorScheme: 'bnbColors',
datasource: '3__table',
@@ -313,7 +313,7 @@ describe('legend sorting', () => {
queriesData,
});
- it('sort legend by data', () => {
+ test('sort legend by data', () => {
const chartProps = getChartProps({
legendSort: null,
});
@@ -326,7 +326,7 @@ describe('legend sorting', () => {
]);
});
- it('sort legend by label ascending', () => {
+ test('sort legend by label ascending', () => {
const chartProps = getChartProps({
legendSort: 'asc',
});
@@ -339,7 +339,7 @@ describe('legend sorting', () => {
]);
});
- it('sort legend by label descending', () => {
+ test('sort legend by label descending', () => {
const chartProps = getChartProps({
legendSort: 'desc',
});
diff --git a/superset-frontend/plugins/plugin-chart-echarts/test/MixedTimeseries/transformProps.test.ts b/superset-frontend/plugins/plugin-chart-echarts/test/MixedTimeseries/transformProps.test.ts
index ece226e319a..3562a3a7668 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/test/MixedTimeseries/transformProps.test.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/test/MixedTimeseries/transformProps.test.ts
@@ -211,7 +211,7 @@ describe('legend sorting', () => {
},
});
- it('sort legend by data', () => {
+ test('sort legend by data', () => {
const chartProps = getChartProps({
legendSort: null,
});
@@ -227,7 +227,7 @@ describe('legend sorting', () => {
]);
});
- it('sort legend by label ascending', () => {
+ test('sort legend by label ascending', () => {
const chartProps = getChartProps({
legendSort: 'asc',
});
@@ -243,7 +243,7 @@ describe('legend sorting', () => {
]);
});
- it('sort legend by label descending', () => {
+ test('sort legend by label descending', () => {
const chartProps = getChartProps({
legendSort: 'desc',
});
diff --git a/superset-frontend/plugins/plugin-chart-echarts/test/Pie/buildQuery.test.ts b/superset-frontend/plugins/plugin-chart-echarts/test/Pie/buildQuery.test.ts
index fa40dbf8f16..249a55671c4 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/test/Pie/buildQuery.test.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/test/Pie/buildQuery.test.ts
@@ -27,7 +27,7 @@ describe('Pie buildQuery', () => {
viz_type: 'my_chart',
};
- it('should build query fields from form data', () => {
+ test('should build query fields from form data', () => {
const queryContext = buildQuery(formData);
const [query] = queryContext.queries;
expect(query.metrics).toEqual(['foo']);
diff --git a/superset-frontend/plugins/plugin-chart-echarts/test/Pie/transformProps.test.ts b/superset-frontend/plugins/plugin-chart-echarts/test/Pie/transformProps.test.ts
index 26de27dd352..d2daf2d1d6a 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/test/Pie/transformProps.test.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/test/Pie/transformProps.test.ts
@@ -59,7 +59,7 @@ describe('Pie transformProps', () => {
theme: supersetTheme,
});
- it('should transform chart props for viz', () => {
+ test('should transform chart props for viz', () => {
expect(transformProps(chartProps as EchartsPieChartProps)).toEqual(
expect.objectContaining({
width: 800,
@@ -87,7 +87,7 @@ describe('Pie transformProps', () => {
});
describe('formatPieLabel', () => {
- it('should generate a valid pie chart label', () => {
+ test('should generate a valid pie chart label', () => {
const numberFormatter = getNumberFormatter();
const params = { name: 'My Label', value: 1234, percent: 12.34 };
expect(
@@ -191,7 +191,7 @@ describe('Pie label string template', () => {
return (formatter as LabelFormatterCallback)(params);
};
- it('should generate a valid pie chart label with template', () => {
+ test('should generate a valid pie chart label with template', () => {
expect(
format({
label_type: 'template',
@@ -200,7 +200,7 @@ describe('Pie label string template', () => {
).toEqual('Tablet:123k\n55.50%');
});
- it('should be formatted using the number formatter', () => {
+ test('should be formatted using the number formatter', () => {
expect(
format({
label_type: 'template',
@@ -210,7 +210,7 @@ describe('Pie label string template', () => {
).toEqual('Tablet:123,456\n55.50%');
});
- it('should be compatible with ECharts raw variable syntax', () => {
+ test('should be compatible with ECharts raw variable syntax', () => {
expect(
format({
label_type: 'template',
@@ -257,7 +257,7 @@ describe('Total value positioning with legends', () => {
}) as EchartsPieChartProps;
};
- it('should center total text when legend is on the right', () => {
+ test('should center total text when legend is on the right', () => {
const props = getChartPropsWithLegend(true, true, 'right', true);
const transformed = transformProps(props);
@@ -280,7 +280,7 @@ describe('Total value positioning with legends', () => {
expect(leftValue).toBeGreaterThan(30); // Should be reasonable positioning
});
- it('should center total text when legend is on the left', () => {
+ test('should center total text when legend is on the left', () => {
const props = getChartPropsWithLegend(true, true, 'left', true);
const transformed = transformProps(props);
@@ -300,7 +300,7 @@ describe('Total value positioning with legends', () => {
expect(leftValue).toBeLessThan(70); // Should be reasonable positioning
});
- it('should center total text when legend is on top', () => {
+ test('should center total text when legend is on top', () => {
const props = getChartPropsWithLegend(true, true, 'top', true);
const transformed = transformProps(props);
@@ -319,7 +319,7 @@ describe('Total value positioning with legends', () => {
expect(topValue).toBeGreaterThan(50); // Shifted down for top legend
});
- it('should center total text when legend is on bottom', () => {
+ test('should center total text when legend is on bottom', () => {
const props = getChartPropsWithLegend(true, true, 'bottom', true);
const transformed = transformProps(props);
@@ -338,7 +338,7 @@ describe('Total value positioning with legends', () => {
expect(topValue).toBeLessThan(50); // Shifted up for bottom legend
});
- it('should use default positioning when no legend is shown', () => {
+ test('should use default positioning when no legend is shown', () => {
const props = getChartPropsWithLegend(true, false, 'right', true);
const transformed = transformProps(props);
@@ -351,7 +351,7 @@ describe('Total value positioning with legends', () => {
);
});
- it('should handle regular pie chart (non-donut) positioning', () => {
+ test('should handle regular pie chart (non-donut) positioning', () => {
const props = getChartPropsWithLegend(true, true, 'right', false);
const transformed = transformProps(props);
@@ -364,7 +364,7 @@ describe('Total value positioning with legends', () => {
);
});
- it('should not show total graphic when showTotal is false', () => {
+ test('should not show total graphic when showTotal is false', () => {
const props = getChartPropsWithLegend(false, true, 'right', true);
const transformed = transformProps(props);
@@ -429,7 +429,7 @@ describe('Other category', () => {
theme: supersetTheme,
});
- it('generates Other category', () => {
+ test('generates Other category', () => {
const chartProps = getChartProps({
threshold_for_other: 20,
});
@@ -500,7 +500,7 @@ describe('legend sorting', () => {
theme: supersetTheme,
});
- it('sort legend by data', () => {
+ test('sort legend by data', () => {
const chartProps = getChartProps({
legendSort: null,
});
@@ -515,7 +515,7 @@ describe('legend sorting', () => {
]);
});
- it('sort legend by label ascending', () => {
+ test('sort legend by label ascending', () => {
const chartProps = getChartProps({
legendSort: 'asc',
});
@@ -530,7 +530,7 @@ describe('legend sorting', () => {
]);
});
- it('sort legend by label descending', () => {
+ test('sort legend by label descending', () => {
const chartProps = getChartProps({
legendSort: 'desc',
});
diff --git a/superset-frontend/plugins/plugin-chart-echarts/test/Radar/transformProps.test.ts b/superset-frontend/plugins/plugin-chart-echarts/test/Radar/transformProps.test.ts
index cc7ba86f9b1..1aef6afdc0b 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/test/Radar/transformProps.test.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/test/Radar/transformProps.test.ts
@@ -93,7 +93,7 @@ const chartProps = new ChartProps({
});
describe('Radar transformProps', () => {
- it('should transform chart props for normalized radar chart & normalize all metrics except the ones with custom min & max', () => {
+ test('should transform chart props for normalized radar chart & normalize all metrics except the ones with custom min & max', () => {
const transformedProps = transformProps(
chartProps as EchartsRadarChartProps,
);
@@ -166,7 +166,7 @@ describe('legend sorting', () => {
queriesData: legendSortData,
});
- it('preserves original data order when no sort specified', () => {
+ test('preserves original data order when no sort specified', () => {
const props = createChartProps({ legendSort: null });
const result = transformProps(props as EchartsRadarChartProps);
@@ -178,7 +178,7 @@ describe('legend sorting', () => {
]);
});
- it('sorts alphabetically ascending when legendSort is "asc"', () => {
+ test('sorts alphabetically ascending when legendSort is "asc"', () => {
const props = createChartProps({ legendSort: 'asc' });
const result = transformProps(props as EchartsRadarChartProps);
@@ -190,7 +190,7 @@ describe('legend sorting', () => {
]);
});
- it('sorts alphabetically descending when legendSort is "desc"', () => {
+ test('sorts alphabetically descending when legendSort is "desc"', () => {
const props = createChartProps({ legendSort: 'desc' });
const result = transformProps(props as EchartsRadarChartProps);
diff --git a/superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/Bar/controlPanel.test.ts b/superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/Bar/controlPanel.test.ts
index ac9262ee6f3..1128af3edb6 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/Bar/controlPanel.test.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/Bar/controlPanel.test.ts
@@ -20,7 +20,7 @@ import controlPanel from '../../../src/Timeseries/Regular/Bar/controlPanel';
describe('Bar Chart Control Panel', () => {
describe('x_axis_time_format control', () => {
- it('should include x_axis_time_format control in the panel', () => {
+ test('should include x_axis_time_format control in the panel', () => {
const config = controlPanel;
// Look for x_axis_time_format control in all sections and rows
@@ -49,7 +49,7 @@ describe('Bar Chart Control Panel', () => {
expect(foundTimeFormatControl).toBe(true);
});
- it('should have correct default value for x_axis_time_format', () => {
+ test('should have correct default value for x_axis_time_format', () => {
const config = controlPanel;
// Find the x_axis_time_format control
@@ -80,7 +80,7 @@ describe('Bar Chart Control Panel', () => {
expect(timeFormatControl.config.default).toBe('smart_date');
});
- it('should have visibility function for x_axis_time_format', () => {
+ test('should have visibility function for x_axis_time_format', () => {
const config = controlPanel;
// Find the x_axis_time_format control
@@ -114,7 +114,7 @@ describe('Bar Chart Control Panel', () => {
// The important part is that the control has proper visibility configuration
});
- it('should have proper control configuration', () => {
+ test('should have proper control configuration', () => {
const config = controlPanel;
// Find the x_axis_time_format control
@@ -153,7 +153,7 @@ describe('Bar Chart Control Panel', () => {
});
describe('Control panel structure for bar charts', () => {
- it('should have Chart Orientation section', () => {
+ test('should have Chart Orientation section', () => {
const config = controlPanel;
const orientationSection = config.controlPanelSections.find(
@@ -164,7 +164,7 @@ describe('Bar Chart Control Panel', () => {
expect(orientationSection!.expanded).toBe(true);
});
- it('should have Chart Options section with X Axis controls', () => {
+ test('should have Chart Options section with X Axis controls', () => {
const config = controlPanel;
const chartOptionsSection = config.controlPanelSections.find(
@@ -179,7 +179,7 @@ describe('Bar Chart Control Panel', () => {
expect(chartOptionsSection!.controlSetRows!.length).toBeGreaterThan(0);
});
- it('should have proper form data overrides', () => {
+ test('should have proper form data overrides', () => {
const config = controlPanel;
expect(config.formDataOverrides).toBeDefined();
diff --git a/superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/Bar/transformProps.test.ts b/superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/Bar/transformProps.test.ts
index 425759ca17a..5a3a63dfdde 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/Bar/transformProps.test.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/Bar/transformProps.test.ts
@@ -56,7 +56,7 @@ describe('Bar Chart X-axis Time Formatting', () => {
};
describe('Default xAxisTimeFormat', () => {
- it('should use smart_date as default xAxisTimeFormat', () => {
+ test('should use smart_date as default xAxisTimeFormat', () => {
const chartProps = new ChartProps({
...baseChartPropsConfig,
formData: baseFormData,
@@ -73,7 +73,7 @@ describe('Bar Chart X-axis Time Formatting', () => {
expect(typeof xAxis.axisLabel.formatter).toBe('function');
});
- it('should apply xAxisTimeFormat from DEFAULT_FORM_DATA when not explicitly set', () => {
+ test('should apply xAxisTimeFormat from DEFAULT_FORM_DATA when not explicitly set', () => {
const formDataWithoutTimeFormat = {
...baseFormData,
};
@@ -96,7 +96,7 @@ describe('Bar Chart X-axis Time Formatting', () => {
});
describe('Custom xAxisTimeFormat', () => {
- it('should respect custom xAxisTimeFormat when explicitly set', () => {
+ test('should respect custom xAxisTimeFormat when explicitly set', () => {
const customFormData = {
...baseFormData,
xAxisTimeFormat: '%Y-%m-%d',
@@ -123,7 +123,7 @@ describe('Bar Chart X-axis Time Formatting', () => {
expect(typeof formatter).toBe('function');
});
- it('should handle different time format options', () => {
+ test('should handle different time format options', () => {
const timeFormats = [
'%Y-%m-%d',
'%Y/%m/%d',
@@ -155,7 +155,7 @@ describe('Bar Chart X-axis Time Formatting', () => {
});
describe('Orientation-specific behavior', () => {
- it('should apply time formatting to x-axis in vertical bar charts', () => {
+ test('should apply time formatting to x-axis in vertical bar charts', () => {
const verticalFormData = {
...baseFormData,
orientation: 'vertical',
@@ -177,7 +177,7 @@ describe('Bar Chart X-axis Time Formatting', () => {
expect(typeof xAxis.axisLabel.formatter).toBe('function');
});
- it('should apply time formatting to y-axis in horizontal bar charts', () => {
+ test('should apply time formatting to y-axis in horizontal bar charts', () => {
const horizontalFormData = {
...baseFormData,
orientation: 'horizontal',
@@ -201,7 +201,7 @@ describe('Bar Chart X-axis Time Formatting', () => {
});
describe('Integration with existing features', () => {
- it('should work with axis bounds', () => {
+ test('should work with axis bounds', () => {
const formDataWithBounds = {
...baseFormData,
xAxisTimeFormat: '%Y-%m-%d',
@@ -224,7 +224,7 @@ describe('Bar Chart X-axis Time Formatting', () => {
expect(transformedProps.echartOptions.xAxis).toBeDefined();
});
- it('should work with label rotation', () => {
+ test('should work with label rotation', () => {
const formDataWithRotation = {
...baseFormData,
xAxisTimeFormat: '%Y-%m-%d',
@@ -245,7 +245,7 @@ describe('Bar Chart X-axis Time Formatting', () => {
expect(xAxis.axisLabel).toHaveProperty('rotate', 45);
});
- it('should maintain time formatting consistency with tooltip', () => {
+ test('should maintain time formatting consistency with tooltip', () => {
const formDataWithTooltip = {
...baseFormData,
xAxisTimeFormat: '%Y-%m-%d',
@@ -270,7 +270,7 @@ describe('Bar Chart X-axis Time Formatting', () => {
});
describe('Regression test for Issue #30373', () => {
- it('should not be stuck on adaptive formatting', () => {
+ test('should not be stuck on adaptive formatting', () => {
// Test the exact scenario described in the issue
const issueFormData = {
...baseFormData,
@@ -297,7 +297,7 @@ describe('Bar Chart X-axis Time Formatting', () => {
// The actual formatting is handled by the underlying time formatter
});
- it('should allow changing from smart_date to other formats', () => {
+ test('should allow changing from smart_date to other formats', () => {
// First create with smart_date (default)
const smartDateFormData = {
...baseFormData,
@@ -340,7 +340,7 @@ describe('Bar Chart X-axis Time Formatting', () => {
expect(typeof customFormatXAxis.axisLabel.formatter).toBe('function');
});
- it('should have xAxisTimeFormat in formData by default', () => {
+ test('should have xAxisTimeFormat in formData by default', () => {
// This test specifically verifies our fix - that DEFAULT_FORM_DATA includes xAxisTimeFormat
const chartProps = new ChartProps({
...baseChartPropsConfig,
diff --git a/superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/buildQuery.test.ts b/superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/buildQuery.test.ts
index ffabe67df14..8caef0d58fe 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/buildQuery.test.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/buildQuery.test.ts
@@ -27,13 +27,13 @@ describe('Timeseries buildQuery', () => {
viz_type: 'my_chart',
};
- it('should build groupby with series in form data', () => {
+ test('should build groupby with series in form data', () => {
const queryContext = buildQuery(formData);
const [query] = queryContext.queries;
expect(query.metrics).toEqual(['bar', 'baz']);
});
- it('should order by timeseries limit if orderby unspecified', () => {
+ test('should order by timeseries limit if orderby unspecified', () => {
const queryContext = buildQuery({
...formData,
timeseries_limit_metric: 'bar',
@@ -46,7 +46,7 @@ describe('Timeseries buildQuery', () => {
expect(query.orderby).toEqual([['bar', false]]);
});
- it('should not order by timeseries limit if orderby provided', () => {
+ test('should not order by timeseries limit if orderby provided', () => {
const queryContext = buildQuery({
...formData,
timeseries_limit_metric: 'bar',
@@ -72,7 +72,7 @@ describe('queryObject conversion', () => {
metrics: ['count(*)'],
};
- it("shouldn't convert queryObject", () => {
+ test("shouldn't convert queryObject", () => {
const { queries } = buildQuery(formData);
expect(queries[0]).toEqual(
expect.objectContaining({
@@ -99,7 +99,7 @@ describe('queryObject conversion', () => {
);
});
- it('should convert queryObject', () => {
+ test('should convert queryObject', () => {
const { queries } = buildQuery({ ...formData, x_axis: 'time_column' });
expect(queries[0]).toMatchObject({
granularity: 'time_column',
diff --git a/superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/constants.test.ts b/superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/constants.test.ts
index ff5bf0dd2bc..3d71c5ee7f8 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/constants.test.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/constants.test.ts
@@ -20,23 +20,23 @@ import { DEFAULT_FORM_DATA } from '../../src/Timeseries/constants';
describe('Timeseries constants', () => {
describe('DEFAULT_FORM_DATA', () => {
- it('should include xAxisTimeFormat in default form data', () => {
+ test('should include xAxisTimeFormat in default form data', () => {
expect(DEFAULT_FORM_DATA).toHaveProperty('xAxisTimeFormat');
expect(DEFAULT_FORM_DATA.xAxisTimeFormat).toBe('smart_date');
});
- it('should include tooltipTimeFormat in default form data', () => {
+ test('should include tooltipTimeFormat in default form data', () => {
expect(DEFAULT_FORM_DATA).toHaveProperty('tooltipTimeFormat');
expect(DEFAULT_FORM_DATA.tooltipTimeFormat).toBe('smart_date');
});
- it('should have consistent time format defaults', () => {
+ test('should have consistent time format defaults', () => {
expect(DEFAULT_FORM_DATA.xAxisTimeFormat).toBe(
DEFAULT_FORM_DATA.tooltipTimeFormat,
);
});
- it('should have vertical orientation as default', () => {
+ test('should have vertical orientation as default', () => {
expect(DEFAULT_FORM_DATA.orientation).toBe('vertical');
});
});
diff --git a/superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformProps.test.ts b/superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformProps.test.ts
index f6e7c3e770c..562f3fd5190 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformProps.test.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformProps.test.ts
@@ -79,7 +79,7 @@ const chartPropsConfig = {
};
describe('EchartsTimeseries transformProps', () => {
- it('should transform chart props for viz', () => {
+ test('should transform chart props for viz', () => {
const chartProps = new ChartProps(chartPropsConfig);
expect(transformProps(chartProps as EchartsTimeseriesChartProps)).toEqual(
expect.objectContaining({
@@ -110,7 +110,7 @@ describe('EchartsTimeseries transformProps', () => {
);
});
- it('should transform chart props for horizontal viz', () => {
+ test('should transform chart props for horizontal viz', () => {
const chartProps = new ChartProps({
...chartPropsConfig,
formData: {
@@ -147,7 +147,7 @@ describe('EchartsTimeseries transformProps', () => {
);
});
- it('should add a formula annotation to viz', () => {
+ test('should add a formula annotation to viz', () => {
const formula: FormulaAnnotationLayer = {
name: 'My Formula',
annotationType: AnnotationType.Formula,
@@ -199,7 +199,7 @@ describe('EchartsTimeseries transformProps', () => {
);
});
- it('should add an interval, event and timeseries annotation to viz', () => {
+ test('should add an interval, event and timeseries annotation to viz', () => {
const event: EventAnnotationLayer = {
annotationType: AnnotationType.Event,
name: 'My Event',
@@ -309,7 +309,7 @@ describe('EchartsTimeseries transformProps', () => {
);
});
- it('Should add a baseline series for stream graph', () => {
+ test('Should add a baseline series for stream graph', () => {
const streamQueriesData = [
{
data: createTestData(
@@ -486,7 +486,7 @@ describe('Does transformProps transform series correctly', () => {
[] as number[],
);
- it('should show labels when showValue is true', () => {
+ test('should show labels when showValue is true', () => {
const chartProps = new ChartProps(chartPropsConfig);
const transformedSeries = transformProps(
@@ -498,7 +498,7 @@ describe('Does transformProps transform series correctly', () => {
});
});
- it('should not show labels when showValue is false', () => {
+ test('should not show labels when showValue is false', () => {
const updatedChartPropsConfig = {
...chartPropsConfig,
formData: { ...formData, showValue: false },
@@ -515,7 +515,7 @@ describe('Does transformProps transform series correctly', () => {
});
});
- it('should show only totals when onlyTotal is true', () => {
+ test('should show only totals when onlyTotal is true', () => {
const updatedChartPropsConfig = {
...chartPropsConfig,
formData: { ...formData, onlyTotal: true },
@@ -560,7 +560,7 @@ describe('Does transformProps transform series correctly', () => {
});
});
- it('should show labels on values >= percentageThreshold if onlyTotal is false', () => {
+ test('should show labels on values >= percentageThreshold if onlyTotal is false', () => {
const chartProps = new ChartProps(chartPropsConfig);
const transformedSeries = transformProps(
@@ -586,7 +586,7 @@ describe('Does transformProps transform series correctly', () => {
});
});
- it('should not apply percentage threshold when showValue is true and stack is false', () => {
+ test('should not apply percentage threshold when showValue is true and stack is false', () => {
const updatedChartPropsConfig = {
...chartPropsConfig,
formData: { ...formData, stack: false },
@@ -612,7 +612,7 @@ describe('Does transformProps transform series correctly', () => {
});
});
- it('should remove time shift labels from label_map', () => {
+ test('should remove time shift labels from label_map', () => {
const updatedChartPropsConfig = {
...chartPropsConfig,
formData: {
@@ -686,7 +686,7 @@ describe('legend sorting', () => {
queriesData: legendSortData,
});
- it('sort legend by data', () => {
+ test('sort legend by data', () => {
const chartProps = getChartProps({
legendSort: null,
sortSeriesType: 'min',
@@ -704,7 +704,7 @@ describe('legend sorting', () => {
]);
});
- it('sort legend by label ascending', () => {
+ test('sort legend by label ascending', () => {
const chartProps = getChartProps({
legendSort: 'asc',
sortSeriesType: 'min',
@@ -722,7 +722,7 @@ describe('legend sorting', () => {
]);
});
- it('sort legend by label descending', () => {
+ test('sort legend by label descending', () => {
const chartProps = getChartProps({
legendSort: 'desc',
sortSeriesType: 'min',
diff --git a/superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformers.test.ts b/superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformers.test.ts
index f5770b6fe3f..ae7a7423f72 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformers.test.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/test/Timeseries/transformers.test.ts
@@ -40,7 +40,7 @@ const mockColorScale = jest.fn(
describe('transformSeries', () => {
const series = { name: 'test-series' };
- it('should use the colorScaleKey if timeShiftColor is enabled', () => {
+ test('should use the colorScaleKey if timeShiftColor is enabled', () => {
const opts = {
timeShiftColor: true,
colorScaleKey: 'test-key',
@@ -52,7 +52,7 @@ describe('transformSeries', () => {
expect((result as any)?.itemStyle.color).toBe('color-for-test-key-1');
});
- it('should use seriesKey if timeShiftColor is not enabled', () => {
+ test('should use seriesKey if timeShiftColor is not enabled', () => {
const opts = {
timeShiftColor: false,
seriesKey: 'series-key',
@@ -64,7 +64,7 @@ describe('transformSeries', () => {
expect((result as any)?.itemStyle.color).toBe('color-for-series-key-2');
});
- it('should apply border styles for bar series with connectNulls', () => {
+ test('should apply border styles for bar series with connectNulls', () => {
const opts = {
seriesType: EchartsTimeseriesSeriesType.Bar,
connectNulls: true,
@@ -80,7 +80,7 @@ describe('transformSeries', () => {
);
});
- it('should not apply border styles for non-bar series', () => {
+ test('should not apply border styles for non-bar series', () => {
const opts = {
seriesType: EchartsTimeseriesSeriesType.Line,
connectNulls: true,
@@ -94,7 +94,7 @@ describe('transformSeries', () => {
expect((result as any).itemStyle.borderColor).toBeUndefined();
});
- it('should dim series when selectedValues does not include series name (dimension-based filtering)', () => {
+ test('should dim series when selectedValues does not include series name (dimension-based filtering)', () => {
const opts = {
filterState: { selectedValues: ['other-series'] },
hasDimensions: true,
@@ -108,7 +108,7 @@ describe('transformSeries', () => {
expect((result as any).itemStyle.opacity).toBe(0.3);
});
- it('should not dim series when hasDimensions is false (X-axis cross-filtering)', () => {
+ test('should not dim series when hasDimensions is false (X-axis cross-filtering)', () => {
const opts = {
filterState: { selectedValues: ['Product A'] },
hasDimensions: false,
@@ -124,7 +124,7 @@ describe('transformSeries', () => {
});
describe('transformNegativeLabelsPosition', () => {
- it('label position bottom of negative value no Horizontal', () => {
+ test('label position bottom of negative value no Horizontal', () => {
const isHorizontal = false;
const series: SeriesOption = {
data: [
@@ -148,7 +148,7 @@ describe('transformNegativeLabelsPosition', () => {
expect((result as any)[4].label).toBe(undefined);
});
- it('label position left of negative value is Horizontal', () => {
+ test('label position left of negative value is Horizontal', () => {
const isHorizontal = true;
const series: SeriesOption = {
data: [
@@ -173,7 +173,7 @@ describe('transformNegativeLabelsPosition', () => {
expect((result as any)[4].label.position).toBe('outside');
});
- it('label position to line type', () => {
+ test('label position to line type', () => {
const isHorizontal = false;
const series: SeriesOption = {
data: [
@@ -201,7 +201,7 @@ describe('transformNegativeLabelsPosition', () => {
expect((result as any)[4].label).toBe(undefined);
});
- it('label position to bar type and stack', () => {
+ test('label position to bar type and stack', () => {
const isHorizontal = false;
const series: SeriesOption = {
data: [
@@ -286,14 +286,12 @@ function setupGetChartPaddingMock(): jest.SpyInstance {
top?: number;
}
| undefined,
- ) => {
- return {
- bottom: padding?.bottom ?? 0,
- left: padding?.left ?? 0,
- right: padding?.right ?? 0,
- top: padding?.top ?? 0,
- };
- },
+ ) => ({
+ bottom: padding?.bottom ?? 0,
+ left: padding?.left ?? 0,
+ right: padding?.right ?? 0,
+ top: padding?.top ?? 0,
+ }),
);
return getChartPaddingSpy;
}
diff --git a/superset-frontend/plugins/plugin-chart-echarts/test/Tree/buildQuery.test.ts b/superset-frontend/plugins/plugin-chart-echarts/test/Tree/buildQuery.test.ts
index 38006defde5..35b16b9c05f 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/test/Tree/buildQuery.test.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/test/Tree/buildQuery.test.ts
@@ -19,7 +19,7 @@
import buildQuery from '../../src/Tree/buildQuery';
describe('Tree buildQuery', () => {
- it('should build query', () => {
+ test('should build query', () => {
const formData = {
datasource: '5__table',
granularity_sqla: 'ds',
@@ -34,7 +34,7 @@ describe('Tree buildQuery', () => {
expect(query.columns).toEqual(['id_col', 'relation_col', 'name_col']);
expect(query.metrics).toEqual(['foo', 'bar']);
});
- it('should build query without name column', () => {
+ test('should build query without name column', () => {
const formData = {
datasource: '5__table',
granularity_sqla: 'ds',
diff --git a/superset-frontend/plugins/plugin-chart-echarts/test/Tree/transformProps.test.ts b/superset-frontend/plugins/plugin-chart-echarts/test/Tree/transformProps.test.ts
index e878dcf6b72..9721fc64cf4 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/test/Tree/transformProps.test.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/test/Tree/transformProps.test.ts
@@ -38,7 +38,7 @@ describe('EchartsTree transformProps', () => {
height: 600,
theme: supersetTheme,
};
- it('should transform when parent present before child', () => {
+ test('should transform when parent present before child', () => {
const queriesData = [
{
colnames: ['id_column', 'relation_column', 'name_column', 'count'],
@@ -105,7 +105,7 @@ describe('EchartsTree transformProps', () => {
}),
);
});
- it('should transform when child is present before parent', () => {
+ test('should transform when child is present before parent', () => {
const queriesData = [
{
colnames: ['id_column', 'relation_column', 'name_column', 'count'],
@@ -175,7 +175,7 @@ describe('EchartsTree transformProps', () => {
}),
);
});
- it('ignore node if not attached to root', () => {
+ test('ignore node if not attached to root', () => {
const formData = {
colorScheme: 'bnbColors',
datasource: '3__table',
@@ -256,7 +256,7 @@ describe('EchartsTree transformProps', () => {
}),
);
});
- it('should transform props if name column is not specified', () => {
+ test('should transform props if name column is not specified', () => {
const formData = {
colorScheme: 'bnbColors',
datasource: '3__table',
@@ -338,7 +338,7 @@ describe('EchartsTree transformProps', () => {
}),
);
});
- it('should find root node with null parent when root node name is not provided', () => {
+ test('should find root node with null parent when root node name is not provided', () => {
const formData = {
colorScheme: 'bnbColors',
datasource: '3__table',
diff --git a/superset-frontend/plugins/plugin-chart-echarts/test/Treemap/buildQuery.test.ts b/superset-frontend/plugins/plugin-chart-echarts/test/Treemap/buildQuery.test.ts
index 913237f915a..f09419e867e 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/test/Treemap/buildQuery.test.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/test/Treemap/buildQuery.test.ts
@@ -27,7 +27,7 @@ describe('Treemap buildQuery', () => {
viz_type: 'my_chart',
};
- it('should build query fields from form data', () => {
+ test('should build query fields from form data', () => {
const queryContext = buildQuery(formData);
const [query] = queryContext.queries;
expect(query.metrics).toEqual(['foo']);
diff --git a/superset-frontend/plugins/plugin-chart-echarts/test/Treemap/transformProps.test.ts b/superset-frontend/plugins/plugin-chart-echarts/test/Treemap/transformProps.test.ts
index d076f5a8a76..e8e832f0b7c 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/test/Treemap/transformProps.test.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/test/Treemap/transformProps.test.ts
@@ -44,7 +44,7 @@ describe('Treemap transformProps', () => {
theme: supersetTheme,
});
- it('should transform chart props for viz', () => {
+ test('should transform chart props for viz', () => {
expect(transformProps(chartProps as EchartsTreemapChartProps)).toEqual(
expect.objectContaining({
width: 800,
diff --git a/superset-frontend/plugins/plugin-chart-echarts/test/Waterfall/buildQuery.test.ts b/superset-frontend/plugins/plugin-chart-echarts/test/Waterfall/buildQuery.test.ts
index e5e50278f71..5eace89fcc7 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/test/Waterfall/buildQuery.test.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/test/Waterfall/buildQuery.test.ts
@@ -29,7 +29,7 @@ describe('Waterfall buildQuery', () => {
viz_type: VizType.Waterfall,
};
- it('should build query fields from form data', () => {
+ test('should build query fields from form data', () => {
const queryContext = buildQuery(formData as unknown as SqlaFormData);
const [query] = queryContext.queries;
expect(query.metrics).toEqual(['foo']);
diff --git a/superset-frontend/plugins/plugin-chart-echarts/test/utils/annotation.test.ts b/superset-frontend/plugins/plugin-chart-echarts/test/utils/annotation.test.ts
index fd54fcd9e1b..e9432a57c0c 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/test/utils/annotation.test.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/test/utils/annotation.test.ts
@@ -35,7 +35,7 @@ import {
} from '../../src/utils/annotation';
describe('formatAnnotationLabel', () => {
- it('should handle default cases properly', () => {
+ test('should handle default cases properly', () => {
expect(formatAnnotationLabel('name')).toEqual('name');
expect(formatAnnotationLabel('name', 'title')).toEqual('name - title');
expect(formatAnnotationLabel('name', 'title', ['description'])).toEqual(
@@ -43,7 +43,7 @@ describe('formatAnnotationLabel', () => {
);
});
- it('should handle missing cases properly', () => {
+ test('should handle missing cases properly', () => {
expect(formatAnnotationLabel()).toEqual('');
expect(formatAnnotationLabel(undefined, 'title')).toEqual('title');
expect(formatAnnotationLabel('name', undefined, ['description'])).toEqual(
@@ -54,7 +54,7 @@ describe('formatAnnotationLabel', () => {
).toEqual('description');
});
- it('should handle multiple descriptions properly', () => {
+ test('should handle multiple descriptions properly', () => {
expect(
formatAnnotationLabel('name', 'title', [
'description 1',
@@ -71,7 +71,7 @@ describe('formatAnnotationLabel', () => {
});
describe('extractForecastSeriesContext', () => {
- it('should extract the correct series name and type', () => {
+ test('should extract the correct series name and type', () => {
expect(parseAnnotationOpacity(AnnotationOpacity.Low)).toEqual(0.2);
expect(parseAnnotationOpacity(AnnotationOpacity.Medium)).toEqual(0.5);
expect(parseAnnotationOpacity(AnnotationOpacity.High)).toEqual(0.8);
@@ -81,7 +81,7 @@ describe('extractForecastSeriesContext', () => {
});
describe('extractAnnotationLabels', () => {
- it('should extract all annotations that can be added to the legend', () => {
+ test('should extract all annotations that can be added to the legend', () => {
const layers: AnnotationLayer[] = [
{
annotationType: AnnotationType.Formula,
@@ -140,7 +140,7 @@ describe('evalFormula', () => {
value: 'x+1',
showLabel: true,
};
- it('Should evaluate a regular formula', () => {
+ test('Should evaluate a regular formula', () => {
const data: TimeseriesDataRecord[] = [
{ __timestamp: 0 },
{ __timestamp: 10 },
@@ -152,7 +152,7 @@ describe('evalFormula', () => {
]);
});
- it('Should evaluate a formula containing redundant characters', () => {
+ test('Should evaluate a formula containing redundant characters', () => {
const data: TimeseriesDataRecord[] = [
{ __timestamp: 0 },
{ __timestamp: 10 },
@@ -171,7 +171,7 @@ describe('evalFormula', () => {
]);
});
- it('Should evaluate a formula if axis type is category', () => {
+ test('Should evaluate a formula if axis type is category', () => {
const data: DataRecord[] = [{ gender: 'boy' }, { gender: 'girl' }];
expect(
diff --git a/superset-frontend/plugins/plugin-chart-echarts/test/utils/controls.test.ts b/superset-frontend/plugins/plugin-chart-echarts/test/utils/controls.test.ts
index cb0faac5959..26b33672d93 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/test/utils/controls.test.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/test/utils/controls.test.ts
@@ -19,14 +19,14 @@
import { parseAxisBound } from '../../src/utils/controls';
describe('parseYAxisBound', () => {
- it('should return undefined for invalid values', () => {
+ test('should return undefined for invalid values', () => {
expect(parseAxisBound(null)).toBeUndefined();
expect(parseAxisBound(undefined)).toBeUndefined();
expect(parseAxisBound(NaN)).toBeUndefined();
expect(parseAxisBound('abc')).toBeUndefined();
});
- it('should return numeric value for valid values', () => {
+ test('should return numeric value for valid values', () => {
expect(parseAxisBound(0)).toEqual(0);
expect(parseAxisBound('0')).toEqual(0);
expect(parseAxisBound(1)).toEqual(1);
diff --git a/superset-frontend/plugins/plugin-chart-echarts/test/utils/forecast.test.ts b/superset-frontend/plugins/plugin-chart-echarts/test/utils/forecast.test.ts
index e737cdada7a..a347ff918fd 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/test/utils/forecast.test.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/test/utils/forecast.test.ts
@@ -28,7 +28,7 @@ import {
import { ForecastSeriesEnum } from '../../src/types';
describe('extractForecastSeriesContext', () => {
- it('should extract the correct series name and type', () => {
+ test('should extract the correct series name and type', () => {
expect(extractForecastSeriesContext('abcd')).toEqual({
name: 'abcd',
type: ForecastSeriesEnum.Observation,
@@ -49,7 +49,7 @@ describe('extractForecastSeriesContext', () => {
});
describe('reorderForecastSeries', () => {
- it('should reorder the forecast series and preserve values', () => {
+ test('should reorder the forecast series and preserve values', () => {
const input: SeriesOption[] = [
{ id: `series${ForecastSeriesEnum.Observation}`, data: [10, 20, 30] },
{ id: `series${ForecastSeriesEnum.ForecastTrend}`, data: [15, 25, 35] },
@@ -65,16 +65,16 @@ describe('reorderForecastSeries', () => {
expect(reorderForecastSeries(input)).toEqual(expectedOutput);
});
- it('should handle an empty array', () => {
+ test('should handle an empty array', () => {
expect(reorderForecastSeries([])).toEqual([]);
});
- it('should not reorder if no relevant series are present', () => {
+ test('should not reorder if no relevant series are present', () => {
const input: SeriesOption[] = [{ id: 'some-other-series' }];
expect(reorderForecastSeries(input)).toEqual(input);
});
- it('should handle undefined ids', () => {
+ test('should handle undefined ids', () => {
const input: SeriesOption[] = [
{ id: `series${ForecastSeriesEnum.ForecastLower}` },
{ id: undefined },
@@ -90,7 +90,7 @@ describe('reorderForecastSeries', () => {
});
describe('rebaseForecastDatum', () => {
- it('should subtract lower confidence level from upper value', () => {
+ test('should subtract lower confidence level from upper value', () => {
expect(
rebaseForecastDatum([
{
@@ -146,7 +146,7 @@ describe('rebaseForecastDatum', () => {
]);
});
- it('should rename all series based on verboseMap but leave __timestamp alone', () => {
+ test('should rename all series based on verboseMap but leave __timestamp alone', () => {
expect(
rebaseForecastDatum(
[
diff --git a/superset-frontend/plugins/plugin-chart-echarts/test/utils/formatters.test.ts b/superset-frontend/plugins/plugin-chart-echarts/test/utils/formatters.test.ts
index f8d40a5bd13..daa15d9aa01 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/test/utils/formatters.test.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/test/utils/formatters.test.ts
@@ -21,15 +21,15 @@ import { getPercentFormatter } from '../../src/utils/formatters';
describe('getPercentFormatter', () => {
const value = 0.6;
- it('should format as percent if no format is specified', () => {
+ test('should format as percent if no format is specified', () => {
expect(getPercentFormatter().format(value)).toEqual('60%');
});
- it('should format as percent if SMART_NUMBER is specified', () => {
+ test('should format as percent if SMART_NUMBER is specified', () => {
expect(
getPercentFormatter(NumberFormats.SMART_NUMBER).format(value),
).toEqual('60%');
});
- it('should format using a provided format', () => {
+ test('should format using a provided format', () => {
expect(
getPercentFormatter(NumberFormats.PERCENT_2_POINT).format(value),
).toEqual('60.00%');
diff --git a/superset-frontend/plugins/plugin-chart-echarts/test/utils/series.test.ts b/superset-frontend/plugins/plugin-chart-echarts/test/utils/series.test.ts
index 6a1931a2378..467c58f0fd8 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/test/utils/series.test.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/test/utils/series.test.ts
@@ -402,7 +402,7 @@ test('sortAndFilterSeries by name with numbers desc', () => {
});
describe('extractSeries', () => {
- it('should generate a valid ECharts timeseries series object', () => {
+ test('should generate a valid ECharts timeseries series object', () => {
const data = [
{
__timestamp: '2000-01-01',
@@ -447,7 +447,7 @@ describe('extractSeries', () => {
]);
});
- it('should remove rows that have a null x-value', () => {
+ test('should remove rows that have a null x-value', () => {
const data = [
{
x: 1,
@@ -493,7 +493,7 @@ describe('extractSeries', () => {
]);
});
- it('should convert NULL x-values to NULL_STRING for categorical axis', () => {
+ test('should convert NULL x-values to NULL_STRING for categorical axis', () => {
const data = [
{
browser: 'Firefox',
@@ -530,7 +530,7 @@ describe('extractSeries', () => {
]);
});
- it('should do missing value imputation', () => {
+ test('should do missing value imputation', () => {
const data = [
{
__timestamp: '2000-01-01',
@@ -602,7 +602,7 @@ describe('extractSeries', () => {
});
describe('extractGroupbyLabel', () => {
- it('should join together multiple groupby labels', () => {
+ test('should join together multiple groupby labels', () => {
expect(
extractGroupbyLabel({
datum: { a: 'abc', b: 'qwerty' },
@@ -611,13 +611,13 @@ describe('extractGroupbyLabel', () => {
).toEqual('abc, qwerty');
});
- it('should handle a single groupby', () => {
+ test('should handle a single groupby', () => {
expect(
extractGroupbyLabel({ datum: { xyz: 'qqq' }, groupby: ['xyz'] }),
).toEqual('qqq');
});
- it('should handle mixed types', () => {
+ test('should handle mixed types', () => {
expect(
extractGroupbyLabel({
datum: { strcol: 'abc', intcol: 123, floatcol: 0.123, boolcol: true },
@@ -626,7 +626,7 @@ describe('extractGroupbyLabel', () => {
).toEqual('abc, 123, 0.123, true');
});
- it('should handle null and undefined groupby', () => {
+ test('should handle null and undefined groupby', () => {
expect(
extractGroupbyLabel({
datum: { strcol: 'abc', intcol: 123, floatcol: 0.123, boolcol: true },
@@ -638,7 +638,7 @@ describe('extractGroupbyLabel', () => {
});
describe('extractShowValueIndexes', () => {
- it('should return the latest index for stack', () => {
+ test('should return the latest index for stack', () => {
expect(
extractShowValueIndexes(
[
@@ -696,7 +696,7 @@ describe('extractShowValueIndexes', () => {
).toEqual([undefined, 1, 0, 1, undefined, 2, 1, 1, undefined, 1]);
});
- it('should handle the negative numbers for total only', () => {
+ test('should handle the negative numbers for total only', () => {
expect(
extractShowValueIndexes(
[
@@ -758,40 +758,40 @@ describe('extractShowValueIndexes', () => {
describe('formatSeriesName', () => {
const numberFormatter = getNumberFormatter();
const timeFormatter = getTimeFormatter();
- it('should handle missing values properly', () => {
+ test('should handle missing values properly', () => {
expect(formatSeriesName(undefined)).toEqual('');
expect(formatSeriesName(null)).toEqual('');
});
- it('should handle string values properly', () => {
+ test('should handle string values properly', () => {
expect(formatSeriesName('abc XYZ!')).toEqual('abc XYZ!');
});
- it('should handle boolean values properly', () => {
+ test('should handle boolean values properly', () => {
expect(formatSeriesName(true)).toEqual('true');
});
- it('should use default formatting for numeric values without formatter', () => {
+ test('should use default formatting for numeric values without formatter', () => {
expect(formatSeriesName(12345678.9)).toEqual('12345678.9');
});
- it('should use numberFormatter for numeric values when formatter is provided', () => {
+ test('should use numberFormatter for numeric values when formatter is provided', () => {
expect(formatSeriesName(12345678.9, { numberFormatter })).toEqual('12.3M');
});
- it('should use default formatting for date values without formatter', () => {
+ test('should use default formatting for date values without formatter', () => {
expect(formatSeriesName(new Date('2020-09-11'))).toEqual(
'2020-09-11T00:00:00.000Z',
);
});
- it('should use timeFormatter for date values when formatter is provided', () => {
+ test('should use timeFormatter for date values when formatter is provided', () => {
expect(formatSeriesName(new Date('2020-09-11'), { timeFormatter })).toEqual(
'2020-09-11 00:00:00',
);
});
- it('should normalize non-UTC string based timestamp', () => {
+ test('should normalize non-UTC string based timestamp', () => {
const annualTimeFormatter = getTimeFormatter('%Y');
expect(
formatSeriesName('1995-01-01 00:00:00.000000', {
@@ -803,7 +803,7 @@ describe('formatSeriesName', () => {
});
describe('getLegendProps', () => {
- it('should return the correct props for scroll type with top orientation without zoom', () => {
+ test('should return the correct props for scroll type with top orientation without zoom', () => {
expect(
getLegendProps(
LegendType.Scroll,
@@ -822,7 +822,7 @@ describe('getLegendProps', () => {
});
});
- it('should return the correct props for scroll type with top orientation with zoom', () => {
+ test('should return the correct props for scroll type with top orientation with zoom', () => {
expect(
getLegendProps(
LegendType.Scroll,
@@ -841,7 +841,7 @@ describe('getLegendProps', () => {
});
});
- it('should return the correct props for plain type with left orientation', () => {
+ test('should return the correct props for plain type with left orientation', () => {
expect(
getLegendProps(LegendType.Plain, LegendOrientation.Left, true, theme),
).toEqual({
@@ -853,7 +853,7 @@ describe('getLegendProps', () => {
});
});
- it('should return the correct props for plain type with right orientation without zoom', () => {
+ test('should return the correct props for plain type with right orientation without zoom', () => {
expect(
getLegendProps(
LegendType.Plain,
@@ -872,7 +872,7 @@ describe('getLegendProps', () => {
});
});
- it('should return the correct props for plain type with right orientation with zoom', () => {
+ test('should return the correct props for plain type with right orientation with zoom', () => {
expect(
getLegendProps(
LegendType.Plain,
@@ -891,7 +891,7 @@ describe('getLegendProps', () => {
});
});
- it('should default plain legends to scroll for bottom orientation', () => {
+ test('should default plain legends to scroll for bottom orientation', () => {
expect(
getLegendProps(LegendType.Plain, LegendOrientation.Bottom, false, theme),
).toEqual({
@@ -903,7 +903,7 @@ describe('getLegendProps', () => {
});
});
- it('should default plain legends to scroll for top orientation', () => {
+ test('should default plain legends to scroll for top orientation', () => {
expect(
getLegendProps(LegendType.Plain, LegendOrientation.Top, false, theme),
).toEqual({
@@ -918,7 +918,7 @@ describe('getLegendProps', () => {
});
describe('getChartPadding', () => {
- it('should handle top default', () => {
+ test('should handle top default', () => {
expect(getChartPadding(true, LegendOrientation.Top)).toEqual({
bottom: 0,
left: 0,
@@ -927,7 +927,7 @@ describe('getChartPadding', () => {
});
});
- it('should handle left default', () => {
+ test('should handle left default', () => {
expect(getChartPadding(true, LegendOrientation.Left)).toEqual({
bottom: 0,
left: defaultLegendPadding[LegendOrientation.Left],
@@ -936,7 +936,7 @@ describe('getChartPadding', () => {
});
});
- it('should return the default padding when show is false', () => {
+ test('should return the default padding when show is false', () => {
expect(
getChartPadding(false, LegendOrientation.Left, 100, {
top: 10,
@@ -952,7 +952,7 @@ describe('getChartPadding', () => {
});
});
- it('should return the correct padding for left orientation', () => {
+ test('should return the correct padding for left orientation', () => {
expect(getChartPadding(true, LegendOrientation.Left, 100)).toEqual({
bottom: 0,
left: 100,
@@ -969,7 +969,7 @@ describe('getChartPadding', () => {
});
});
- it('should return the correct padding for right orientation', () => {
+ test('should return the correct padding for right orientation', () => {
expect(getChartPadding(true, LegendOrientation.Right, 50)).toEqual({
bottom: 0,
left: 0,
@@ -986,7 +986,7 @@ describe('getChartPadding', () => {
});
});
- it('should return the correct padding for top orientation', () => {
+ test('should return the correct padding for top orientation', () => {
expect(getChartPadding(true, LegendOrientation.Top, 20)).toEqual({
bottom: 0,
left: 0,
@@ -1003,7 +1003,7 @@ describe('getChartPadding', () => {
});
});
- it('should return the correct padding for bottom orientation', () => {
+ test('should return the correct padding for bottom orientation', () => {
expect(getChartPadding(true, LegendOrientation.Bottom, 10)).toEqual({
bottom: 10,
left: 0,
@@ -1022,7 +1022,7 @@ describe('getChartPadding', () => {
});
describe('dedupSeries', () => {
- it('should deduplicate ids in series', () => {
+ test('should deduplicate ids in series', () => {
expect(
dedupSeries([
{
@@ -1048,17 +1048,17 @@ describe('dedupSeries', () => {
});
describe('sanitizeHtml', () => {
- it('should remove html tags from series name', () => {
+ test('should remove html tags from series name', () => {
expect(sanitizeHtml(NULL_STRING)).toEqual('<NULL>');
});
});
describe('getOverMaxHiddenFormatter', () => {
- it('should hide value if greater than max', () => {
+ test('should hide value if greater than max', () => {
const formatter = getOverMaxHiddenFormatter({ max: 81000 });
expect(formatter.format(84500)).toEqual('');
});
- it('should show value if less or equal than max', () => {
+ test('should show value if less or equal than max', () => {
const formatter = getOverMaxHiddenFormatter({ max: 81000 });
expect(formatter.format(81000)).toEqual('81000');
expect(formatter.format(50000)).toEqual('50000');
@@ -1207,12 +1207,12 @@ test('getMinAndMaxFromBounds returns automatic lower bound when truncating', ()
});
describe('getTimeCompareStackId', () => {
- it('returns the defaultId when timeCompare is empty', () => {
+ test('returns the defaultId when timeCompare is empty', () => {
const result = getTimeCompareStackId('default', []);
expect(result).toEqual('default');
});
- it('returns the defaultId when no value in timeCompare is included in name', () => {
+ test('returns the defaultId when no value in timeCompare is included in name', () => {
const result = getTimeCompareStackId(
'default',
['compare1', 'compare2'],
@@ -1221,7 +1221,7 @@ describe('getTimeCompareStackId', () => {
expect(result).toEqual('default');
});
- it('returns the first value in timeCompare that is included in name', () => {
+ test('returns the first value in timeCompare that is included in name', () => {
const result = getTimeCompareStackId(
'default',
['compare1', 'compare2'],
@@ -1230,7 +1230,7 @@ describe('getTimeCompareStackId', () => {
expect(result).toEqual('compare1');
});
- it('handles name being a number', () => {
+ test('handles name being a number', () => {
const result = getTimeCompareStackId('default', ['123', '456'], 123);
expect(result).toEqual('123');
});
diff --git a/superset-frontend/plugins/plugin-chart-echarts/test/utils/transformers.test.ts b/superset-frontend/plugins/plugin-chart-echarts/test/utils/transformers.test.ts
index 7e2008753c2..21396a08226 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/test/utils/transformers.test.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/test/utils/transformers.test.ts
@@ -58,7 +58,7 @@ const mockFormulaAnnotationLayer: FormulaAnnotationLayer = {
};
describe('transformFormulaAnnotation', () => {
- it('should transform data correctly', () => {
+ test('should transform data correctly', () => {
expect(
transformFormulaAnnotation(
mockFormulaAnnotationLayer,
@@ -74,7 +74,7 @@ describe('transformFormulaAnnotation', () => {
]);
});
- it('should swap x and y for horizontal chart', () => {
+ test('should swap x and y for horizontal chart', () => {
expect(
transformFormulaAnnotation(
mockFormulaAnnotationLayer,
@@ -126,7 +126,7 @@ const mockIntervalAnnotationData: AnnotationData = {
};
describe('transformIntervalAnnotation', () => {
- it('should transform data correctly', () => {
+ test('should transform data correctly', () => {
expect(
transformIntervalAnnotation(
mockIntervalAnnotationLayer,
@@ -153,7 +153,7 @@ describe('transformIntervalAnnotation', () => {
]);
});
- it('should use yAxis for horizontal chart data', () => {
+ test('should use yAxis for horizontal chart data', () => {
expect(
transformIntervalAnnotation(
mockIntervalAnnotationLayer,
@@ -217,7 +217,7 @@ const mockEventAnnotationData: AnnotationData = {
};
describe('transformEventAnnotation', () => {
- it('should transform data correctly', () => {
+ test('should transform data correctly', () => {
expect(
transformEventAnnotation(
mockEventAnnotationLayer,
@@ -239,7 +239,7 @@ describe('transformEventAnnotation', () => {
]);
});
- it('should use yAxis for horizontal chart data', () => {
+ test('should use yAxis for horizontal chart data', () => {
expect(
transformEventAnnotation(
mockEventAnnotationLayer,
@@ -292,7 +292,7 @@ const mockTimeseriesAnnotationData: AnnotationData = {
};
describe('transformTimeseriesAnnotation', () => {
- it('should transform data correctly', () => {
+ test('should transform data correctly', () => {
expect(
transformTimeseriesAnnotation(
mockTimeseriesAnnotationLayer,
@@ -310,7 +310,7 @@ describe('transformTimeseriesAnnotation', () => {
]);
});
- it('should swap x and y for horizontal chart', () => {
+ test('should swap x and y for horizontal chart', () => {
expect(
transformTimeseriesAnnotation(
mockTimeseriesAnnotationLayer,
diff --git a/superset-frontend/plugins/plugin-chart-echarts/test/utils/treeBuilder.test.ts b/superset-frontend/plugins/plugin-chart-echarts/test/utils/treeBuilder.test.ts
index b91349a8953..874bd24cd90 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/test/utils/treeBuilder.test.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/test/utils/treeBuilder.test.ts
@@ -64,7 +64,7 @@ describe('test treeBuilder', () => {
count2: 3,
},
];
- it('should build tree as expected', () => {
+ test('should build tree as expected', () => {
const tree = treeBuilder(data, ['foo', 'bar'], 'count');
expect(tree).toEqual([
{
@@ -168,7 +168,7 @@ describe('test treeBuilder', () => {
]);
});
- it('should build tree with secondaryValue as expected', () => {
+ test('should build tree with secondaryValue as expected', () => {
const tree = treeBuilder(data, ['foo', 'bar'], 'count', 'count2');
expect(tree).toEqual([
{
diff --git a/superset-frontend/plugins/plugin-chart-handlebars/test/index.test.ts b/superset-frontend/plugins/plugin-chart-handlebars/test/index.test.ts
index 9121daeca4d..16df5aecd58 100644
--- a/superset-frontend/plugins/plugin-chart-handlebars/test/index.test.ts
+++ b/superset-frontend/plugins/plugin-chart-handlebars/test/index.test.ts
@@ -27,7 +27,7 @@ import { HandlebarsChartPlugin } from '../src';
* properly transform the data and/or any resulting props).
*/
describe('@superset-ui/plugin-chart-handlebars', () => {
- it('exists', () => {
+ test('exists', () => {
expect(HandlebarsChartPlugin).toBeDefined();
});
});
diff --git a/superset-frontend/plugins/plugin-chart-handlebars/test/plugin/buildQuery.test.ts b/superset-frontend/plugins/plugin-chart-handlebars/test/plugin/buildQuery.test.ts
index 6f84b6afe4b..d9bc12497c4 100644
--- a/superset-frontend/plugins/plugin-chart-handlebars/test/plugin/buildQuery.test.ts
+++ b/superset-frontend/plugins/plugin-chart-handlebars/test/plugin/buildQuery.test.ts
@@ -29,7 +29,7 @@ describe('Handlebars buildQuery', () => {
height: 500,
};
- it('should build groupby with series in form data', () => {
+ test('should build groupby with series in form data', () => {
const queryContext = buildQuery(formData);
const [query] = queryContext.queries;
expect(query.columns).toEqual(['foo']);
diff --git a/superset-frontend/plugins/plugin-chart-handlebars/test/plugin/transformProps.test.ts b/superset-frontend/plugins/plugin-chart-handlebars/test/plugin/transformProps.test.ts
index 4c0c1fe8525..c73abe9dd5b 100644
--- a/superset-frontend/plugins/plugin-chart-handlebars/test/plugin/transformProps.test.ts
+++ b/superset-frontend/plugins/plugin-chart-handlebars/test/plugin/transformProps.test.ts
@@ -41,7 +41,7 @@ describe('Handlebars transformProps', () => {
theme: supersetTheme,
});
- it('should transform chart props for viz', () => {
+ test('should transform chart props for viz', () => {
expect(transformProps(chartProps)).toEqual(
expect.objectContaining({
width: 800,
diff --git a/superset-frontend/plugins/plugin-chart-pivot-table/test/index.test.ts b/superset-frontend/plugins/plugin-chart-pivot-table/test/index.test.ts
index 0461b14810c..f79e98a570e 100644
--- a/superset-frontend/plugins/plugin-chart-pivot-table/test/index.test.ts
+++ b/superset-frontend/plugins/plugin-chart-pivot-table/test/index.test.ts
@@ -27,7 +27,7 @@ import { PivotTableChartPlugin } from '../src';
* properly transform the data and/or any resulting props).
*/
describe('@superset-ui/plugin-chart-pivot-table', () => {
- it('exists', () => {
+ test('exists', () => {
expect(PivotTableChartPlugin).toBeDefined();
});
});
diff --git a/superset-frontend/plugins/plugin-chart-pivot-table/test/plugin/transformProps.test.ts b/superset-frontend/plugins/plugin-chart-pivot-table/test/plugin/transformProps.test.ts
index 7a6fa52f7de..7958ff2c2d3 100644
--- a/superset-frontend/plugins/plugin-chart-pivot-table/test/plugin/transformProps.test.ts
+++ b/superset-frontend/plugins/plugin-chart-pivot-table/test/plugin/transformProps.test.ts
@@ -65,7 +65,7 @@ describe('PivotTableChart transformProps', () => {
theme: supersetTheme,
});
- it('should transform chart props for viz', () => {
+ test('should transform chart props for viz', () => {
expect(transformProps(chartProps)).toEqual({
width: 800,
height: 600,
@@ -98,7 +98,7 @@ describe('PivotTableChart transformProps', () => {
});
describe('Per-cell currency detection (AUTO mode passes through)', () => {
- it('should pass AUTO mode through for per-cell detection (single currency data)', () => {
+ test('should pass AUTO mode through for per-cell detection (single currency data)', () => {
const autoFormData = {
...formData,
currencyFormat: { symbol: 'AUTO', symbolPosition: 'prefix' },
@@ -138,7 +138,7 @@ describe('PivotTableChart transformProps', () => {
expect(result.currencyCodeColumn).toBe('currency');
});
- it('should pass AUTO mode through for per-cell detection (mixed currency data)', () => {
+ test('should pass AUTO mode through for per-cell detection (mixed currency data)', () => {
const autoFormData = {
...formData,
currencyFormat: { symbol: 'AUTO', symbolPosition: 'prefix' },
@@ -177,7 +177,7 @@ describe('PivotTableChart transformProps', () => {
expect(result.currencyCodeColumn).toBe('currency');
});
- it('should pass AUTO mode through when no currency column is defined', () => {
+ test('should pass AUTO mode through when no currency column is defined', () => {
const autoFormData = {
...formData,
currencyFormat: { symbol: 'AUTO', symbolPosition: 'prefix' },
@@ -215,7 +215,7 @@ describe('PivotTableChart transformProps', () => {
expect(result.currencyCodeColumn).toBeUndefined();
});
- it('should handle empty data gracefully in AUTO mode', () => {
+ test('should handle empty data gracefully in AUTO mode', () => {
const autoFormData = {
...formData,
currencyFormat: { symbol: 'AUTO', symbolPosition: 'prefix' },
@@ -249,7 +249,7 @@ describe('PivotTableChart transformProps', () => {
expect(result.currencyCodeColumn).toBe('currency');
});
- it('should preserve static currency format when not using AUTO mode', () => {
+ test('should preserve static currency format when not using AUTO mode', () => {
const staticFormData = {
...formData,
currencyFormat: { symbol: 'EUR', symbolPosition: 'suffix' },
diff --git a/superset-frontend/plugins/plugin-chart-table/test/TableChart.test.tsx b/superset-frontend/plugins/plugin-chart-table/test/TableChart.test.tsx
index beac5a14f7c..d907c1e3eb8 100644
--- a/superset-frontend/plugins/plugin-chart-table/test/TableChart.test.tsx
+++ b/superset-frontend/plugins/plugin-chart-table/test/TableChart.test.tsx
@@ -1473,7 +1473,7 @@ describe('plugin-chart-table', () => {
);
});
- it('recalculates totals when user filters data', async () => {
+ test('recalculates totals when user filters data', async () => {
const formDataWithTotals = {
...testData.basic.formData,
show_totals: true,
@@ -1482,7 +1482,7 @@ describe('plugin-chart-table', () => {
metrics: ['sum__num'],
};
- const data = testData.basic.queriesData[0].data;
+ const { data } = testData.basic.queriesData[0];
const totalBeforeFilter = data.reduce(
(sum, row) => sum + Number(row.sum__num || 0),
0,
diff --git a/superset-frontend/plugins/plugin-chart-table/test/buildQuery.test.ts b/superset-frontend/plugins/plugin-chart-table/test/buildQuery.test.ts
index fb9c5f97a88..aa6e1b83001 100644
--- a/superset-frontend/plugins/plugin-chart-table/test/buildQuery.test.ts
+++ b/superset-frontend/plugins/plugin-chart-table/test/buildQuery.test.ts
@@ -49,7 +49,7 @@ const extraQueryFormData: TableChartFormData = {
};
describe('plugin-chart-table', () => {
describe('buildQuery', () => {
- it('should add post-processing and ignore duplicate metrics', () => {
+ test('should add post-processing and ignore duplicate metrics', () => {
const query = buildQuery({
...basicFormData,
query_mode: QueryMode.Aggregate,
@@ -68,7 +68,7 @@ describe('plugin-chart-table', () => {
]);
});
- it('should not add metrics in raw records mode', () => {
+ test('should not add metrics in raw records mode', () => {
const query = buildQuery({
...basicFormData,
query_mode: QueryMode.Raw,
@@ -80,7 +80,7 @@ describe('plugin-chart-table', () => {
expect(query.post_processing).toEqual([]);
});
- it('should not add post-processing when there is no percent metric', () => {
+ test('should not add post-processing when there is no percent metric', () => {
const query = buildQuery({
...basicFormData,
query_mode: QueryMode.Aggregate,
@@ -91,7 +91,7 @@ describe('plugin-chart-table', () => {
expect(query.post_processing).toEqual([]);
});
- it('should not add post-processing in raw records mode', () => {
+ test('should not add post-processing in raw records mode', () => {
const query = buildQuery({
...basicFormData,
query_mode: QueryMode.Raw,
@@ -103,7 +103,7 @@ describe('plugin-chart-table', () => {
expect(query.columns).toEqual(['rawcol']);
expect(query.post_processing).toEqual([]);
});
- it('should prefer extra_form_data.time_grain_sqla over formData.time_grain_sqla', () => {
+ test('should prefer extra_form_data.time_grain_sqla over formData.time_grain_sqla', () => {
const query = buildQuery({
...basicFormData,
groupby: ['col1'],
@@ -120,7 +120,7 @@ describe('plugin-chart-table', () => {
expressionType: 'SQL',
});
});
- it('should fallback to formData.time_grain_sqla if extra_form_data.time_grain_sqla is not set', () => {
+ test('should fallback to formData.time_grain_sqla if extra_form_data.time_grain_sqla is not set', () => {
const query = buildQuery({
...basicFormData,
time_grain_sqla: TimeGranularity.MONTH,
@@ -136,7 +136,7 @@ describe('plugin-chart-table', () => {
expressionType: 'SQL',
});
});
- it('should include time_grain_sqla in extras if temporal colum is used and keep the rest', () => {
+ test('should include time_grain_sqla in extras if temporal colum is used and keep the rest', () => {
const { queries } = buildQuery({
...extraQueryFormData,
temporal_columns_lookup: { col1: true },
@@ -158,7 +158,7 @@ describe('plugin-chart-table', () => {
groupby: ['category'],
};
- it('should default to row_limit mode with single query', () => {
+ test('should default to row_limit mode with single query', () => {
const { queries } = buildQuery(baseFormDataWithPercents);
expect(queries).toHaveLength(1);
@@ -174,7 +174,7 @@ describe('plugin-chart-table', () => {
]);
});
- it('should create extra query in all_records mode', () => {
+ test('should create extra query in all_records mode', () => {
const formData = {
...baseFormDataWithPercents,
percent_metric_calculation: 'all_records',
@@ -205,7 +205,7 @@ describe('plugin-chart-table', () => {
});
});
- it('should work with show_totals in all_records mode', () => {
+ test('should work with show_totals in all_records mode', () => {
const formData = {
...baseFormDataWithPercents,
percent_metric_calculation: 'all_records',
@@ -219,7 +219,7 @@ describe('plugin-chart-table', () => {
expect(queries[2].metrics).toEqual(['count', 'sum_sales']);
});
- it('should handle empty percent_metrics in all_records mode', () => {
+ test('should handle empty percent_metrics in all_records mode', () => {
const formData = {
...basicFormData,
query_mode: QueryMode.Aggregate,
@@ -251,7 +251,7 @@ describe('plugin-chart-table', () => {
searchColumn: 'category',
};
- it('includes search filter in query payload when server pagination is enabled', () => {
+ test('includes search filter in query payload when server pagination is enabled', () => {
const { queries } = buildQuery(baseFormDataWithServerPagination, {
ownState,
});
@@ -267,7 +267,7 @@ describe('plugin-chart-table', () => {
);
});
- it('does not include search filter when not provided', () => {
+ test('does not include search filter when not provided', () => {
const { queries } = buildQuery(
{
...baseFormDataWithServerPagination,
diff --git a/superset-frontend/plugins/plugin-chart-table/test/sortAlphanumericCaseInsensitive.test.ts b/superset-frontend/plugins/plugin-chart-table/test/sortAlphanumericCaseInsensitive.test.ts
index 663bcc0b6e0..a63e07667c7 100644
--- a/superset-frontend/plugins/plugin-chart-table/test/sortAlphanumericCaseInsensitive.test.ts
+++ b/superset-frontend/plugins/plugin-chart-table/test/sortAlphanumericCaseInsensitive.test.ts
@@ -78,7 +78,7 @@ const testData = [
];
describe('sortAlphanumericCaseInsensitive', () => {
- it('Sort rows', () => {
+ test('Sort rows', () => {
const sorted = [...testData].sort((a, b) =>
// @ts-expect-error
sortAlphanumericCaseInsensitive(a, b, 'col'),
@@ -185,7 +185,7 @@ const testDataMulti: Array>> = [
];
describe('sortAlphanumericCaseInsensitiveMulti', () => {
- it('Sort rows', () => {
+ test('Sort rows', () => {
const sorted = defaultOrderByFn(
[...testDataMulti] as Array>,
[
diff --git a/superset-frontend/plugins/plugin-chart-word-cloud/test/buildQuery.test.ts b/superset-frontend/plugins/plugin-chart-word-cloud/test/buildQuery.test.ts
index 3c918829220..c83f8993e81 100644
--- a/superset-frontend/plugins/plugin-chart-word-cloud/test/buildQuery.test.ts
+++ b/superset-frontend/plugins/plugin-chart-word-cloud/test/buildQuery.test.ts
@@ -29,7 +29,7 @@ describe('WordCloud buildQuery', () => {
viz_type: VizType.WordCloud,
};
- it('should build columns from series in form data', () => {
+ test('should build columns from series in form data', () => {
const queryContext = buildQuery(formData);
const [query] = queryContext.queries;
expect(query.columns).toEqual(['foo']);
diff --git a/superset-frontend/src/.eslintrc.json b/superset-frontend/src/.eslintrc.json
deleted file mode 100644
index 97bb09e4dab..00000000000
--- a/superset-frontend/src/.eslintrc.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "overrides": [
- {
- "files": ["*.test.ts", "*.test.tsx", "*.test.js", "*.test.jsx"],
- "rules": {
- "jest/consistent-test-it": ["error", { "fn": "test" }],
- "no-restricted-globals": ["error", "describe", "it"]
- }
- }
- ]
-}
diff --git a/superset-frontend/src/SqlLab/actions/sqlLab.test.ts b/superset-frontend/src/SqlLab/actions/sqlLab.test.ts
index e1570129cf3..0de713eae3a 100644
--- a/superset-frontend/src/SqlLab/actions/sqlLab.test.ts
+++ b/superset-frontend/src/SqlLab/actions/sqlLab.test.ts
@@ -449,6 +449,7 @@ describe('async actions', () => {
});
});
+ /* oxlint-disable-next-line jest/no-disabled-tests */
test.skip('parses large number result without losing precision', () =>
makeRequest().then(() => {
expect(fetchMock.callHistory.calls(fetchQueryEndpoint)).toHaveLength(1);
diff --git a/superset-frontend/src/SqlLab/components/SaveDatasetModal/SaveDatasetModal.test.tsx b/superset-frontend/src/SqlLab/components/SaveDatasetModal/SaveDatasetModal.test.tsx
index 7998d591388..d17d19e7ca2 100644
--- a/superset-frontend/src/SqlLab/components/SaveDatasetModal/SaveDatasetModal.test.tsx
+++ b/superset-frontend/src/SqlLab/components/SaveDatasetModal/SaveDatasetModal.test.tsx
@@ -372,8 +372,7 @@ describe('SaveDatasetModal', () => {
});
test('clearDatasetCache is imported and available', () => {
- const clearDatasetCache =
- require('src/utils/cachedSupersetGet').clearDatasetCache;
+ const { clearDatasetCache } = require('src/utils/cachedSupersetGet');
expect(clearDatasetCache).toBeDefined();
expect(typeof clearDatasetCache).toBe('function');
diff --git a/superset-frontend/src/components/Chart/ChartContextMenu/ChartContextMenu.test.tsx b/superset-frontend/src/components/Chart/ChartContextMenu/ChartContextMenu.test.tsx
index 797259dee27..131cfbfb8ab 100644
--- a/superset-frontend/src/components/Chart/ChartContextMenu/ChartContextMenu.test.tsx
+++ b/superset-frontend/src/components/Chart/ChartContextMenu/ChartContextMenu.test.tsx
@@ -50,6 +50,7 @@ const TestWrapper = () => {
return (
<>
),
}));
diff --git a/superset-frontend/src/utils/assetUrl.test.ts b/superset-frontend/src/utils/assetUrl.test.ts
index ac501899b7a..f0de28b2c77 100644
--- a/superset-frontend/src/utils/assetUrl.test.ts
+++ b/superset-frontend/src/utils/assetUrl.test.ts
@@ -31,7 +31,7 @@ beforeEach(() => {
});
describe('assetUrl should prepend static asset prefix for relative paths', () => {
- it.each(['', '/myapp'])("'%s' for relative path", app_root => {
+ test.each(['', '/myapp'])("'%s' for relative path", app_root => {
staticAssetsPrefixMock.mockReturnValue(app_root);
expect(assetUrl(resourcePath)).toBe(`${app_root}${resourcePath}`);
expect(assetUrl(absoluteResourcePath)).toBe(
@@ -41,7 +41,7 @@ describe('assetUrl should prepend static asset prefix for relative paths', () =>
});
describe('assetUrl should ignore static asset prefix for absolute URLs', () => {
- it.each(['', '/myapp'])("'%s' for absolute url", app_root => {
+ test.each(['', '/myapp'])("'%s' for absolute url", app_root => {
staticAssetsPrefixMock.mockReturnValue(app_root);
expect(ensureStaticPrefix(absoluteResourcePath)).toBe(absoluteResourcePath);
});