chore(lint): migrate Jest lint rules from eslint to oxlint (#37787)

Signed-off-by: hainenber <dotronghai96@gmail.com>
This commit is contained in:
Đỗ Trọng Hải
2026-02-08 16:44:42 +07:00
committed by GitHub
parent c4d2d42b3b
commit 563d9f1a3f
264 changed files with 1893 additions and 1952 deletions

View File

@@ -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);
});

View File

@@ -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: [
{

View File

@@ -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();
});

View File

@@ -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();
});
});

View File

@@ -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: [

View File

@@ -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);
});

View File

@@ -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: