mirror of
https://github.com/apache/superset.git
synced 2026-05-30 12:49:17 +00:00
feat: AI-powered TypeScript migration framework with parallel processing (#35045)
Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Mehmet Salih Yavuz <salih.yavuz@proton.me> Co-authored-by: Elizabeth Thompson <eschutho@gmail.com>
This commit is contained in:
committed by
GitHub
parent
076e477fd4
commit
ecb3ac68ff
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import { AggregateOption } from './aggregateOptionType';
|
||||
|
||||
test('AggregateOption type should enforce aggregate_name as string', () => {
|
||||
// Test that the type can be properly used
|
||||
const validAggregate: AggregateOption = {
|
||||
aggregate_name: 'SUM',
|
||||
};
|
||||
|
||||
expect(typeof validAggregate.aggregate_name).toBe('string');
|
||||
expect(validAggregate.aggregate_name).toBe('SUM');
|
||||
});
|
||||
|
||||
test('AggregateOption should work with various aggregate names', () => {
|
||||
const aggregates: AggregateOption[] = [
|
||||
{ aggregate_name: 'COUNT' },
|
||||
{ aggregate_name: 'AVG' },
|
||||
{ aggregate_name: 'MIN' },
|
||||
{ aggregate_name: 'MAX' },
|
||||
];
|
||||
|
||||
aggregates.forEach(aggregate => {
|
||||
expect(typeof aggregate.aggregate_name).toBe('string');
|
||||
expect(aggregate.aggregate_name.length).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
@@ -16,9 +16,8 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
export default PropTypes.shape({
|
||||
column_name: PropTypes.string.isRequired,
|
||||
type: PropTypes.string,
|
||||
});
|
||||
export type { AggregateOption } from './types';
|
||||
|
||||
// For backward compatibility with PropTypes usage
|
||||
export { AggregateOption as default } from './types';
|
||||
@@ -16,10 +16,10 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import PropTypes from 'prop-types';
|
||||
import { Column } from '@superset-ui/core';
|
||||
|
||||
export default PropTypes.shape({
|
||||
metric_name: PropTypes.string,
|
||||
verbose_name: PropTypes.string,
|
||||
expression: PropTypes.string,
|
||||
});
|
||||
export type ColumnType = Pick<Column, 'column_name' | 'type'>;
|
||||
|
||||
// For backward compatibility with PropTypes usage - create a placeholder object
|
||||
const columnType = {} as any;
|
||||
export default columnType;
|
||||
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import { savedMetricType } from './savedMetricType';
|
||||
|
||||
test('savedMetricType exports the correct type structure', () => {
|
||||
// Type assertion test - if this compiles without errors,
|
||||
// the type structure is correct
|
||||
const validMetric: savedMetricType = {
|
||||
metric_name: 'test_metric',
|
||||
verbose_name: 'Test Metric',
|
||||
expression: 'SUM(column)',
|
||||
};
|
||||
|
||||
expect(validMetric.metric_name).toBe('test_metric');
|
||||
expect(validMetric.verbose_name).toBe('Test Metric');
|
||||
expect(validMetric.expression).toBe('SUM(column)');
|
||||
});
|
||||
|
||||
test('savedMetricType allows optional verbose_name', () => {
|
||||
// Test that verbose_name is optional
|
||||
const validMetricMinimal: savedMetricType = {
|
||||
metric_name: 'minimal_metric',
|
||||
expression: 'COUNT(*)',
|
||||
};
|
||||
|
||||
expect(validMetricMinimal.metric_name).toBe('minimal_metric');
|
||||
expect(validMetricMinimal.expression).toBe('COUNT(*)');
|
||||
expect(validMetricMinimal.verbose_name).toBeUndefined();
|
||||
});
|
||||
@@ -16,8 +16,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import PropTypes from 'prop-types';
|
||||
export { savedMetricType } from './types';
|
||||
|
||||
export default PropTypes.shape({
|
||||
aggregate_name: PropTypes.string.isRequired,
|
||||
});
|
||||
// For backward compatibility with PropTypes usage
|
||||
export { savedMetricType as default } from './types';
|
||||
@@ -21,3 +21,7 @@ export type savedMetricType = {
|
||||
verbose_name?: string;
|
||||
expression: string;
|
||||
};
|
||||
|
||||
export interface AggregateOption {
|
||||
aggregate_name: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user