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

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