fix: core coverage and add a coverage step in workflow (#20784)
* fix: core coverage * add step in workflow
This commit is contained in:
parent
5ed85f59a1
commit
9c7bcfcead
|
|
@ -51,6 +51,11 @@ jobs:
|
|||
if: steps.check.outcome == 'failure'
|
||||
working-directory: ./superset-frontend
|
||||
run: npm run plugins:build-storybook
|
||||
- name: superset-ui/core coverage
|
||||
if: steps.check.outcome == 'failure'
|
||||
working-directory: ./superset-frontend
|
||||
run: |
|
||||
npm run core:cover
|
||||
- name: unit tests
|
||||
if: steps.check.outcome == 'failure'
|
||||
working-directory: ./superset-frontend
|
||||
|
|
|
|||
|
|
@ -53,7 +53,4 @@ export const DEFAULT_METRICS: Metric[] = [
|
|||
},
|
||||
];
|
||||
|
||||
export const isValidDatasourceType = (datasource: DatasourceType) =>
|
||||
Object.values(DatasourceType).includes(datasource);
|
||||
|
||||
export default {};
|
||||
|
|
|
|||
|
|
@ -19,11 +19,15 @@
|
|||
import { DatasourceKey } from '@superset-ui/core';
|
||||
|
||||
describe('DatasourceKey', () => {
|
||||
const tableKey = '5__table';
|
||||
|
||||
it('should handle table data sources', () => {
|
||||
const datasourceKey = new DatasourceKey(tableKey);
|
||||
expect(datasourceKey.toString()).toBe(tableKey);
|
||||
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', () => {
|
||||
const datasourceKey = new DatasourceKey('5__query');
|
||||
expect(datasourceKey.toString()).toBe('5__query');
|
||||
expect(datasourceKey.toObject()).toEqual({ id: 5, type: 'query' });
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -0,0 +1,37 @@
|
|||
/**
|
||||
* 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 { DatasourceType, DEFAULT_METRICS } from '@superset-ui/core';
|
||||
|
||||
test('DEFAULT_METRICS', () => {
|
||||
expect(DEFAULT_METRICS).toEqual([
|
||||
{
|
||||
metric_name: 'COUNT(*)',
|
||||
expression: 'COUNT(*)',
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
test('DatasourceType', () => {
|
||||
expect(Object.keys(DatasourceType).length).toBe(5);
|
||||
expect(DatasourceType.Table).toBe('table');
|
||||
expect(DatasourceType.Query).toBe('query');
|
||||
expect(DatasourceType.Dataset).toBe('dataset');
|
||||
expect(DatasourceType.SlTable).toBe('sl_table');
|
||||
expect(DatasourceType.SavedQuery).toBe('saved_query');
|
||||
});
|
||||
Loading…
Reference in New Issue