mirror of
https://github.com/apache/superset.git
synced 2026-04-10 03:45:22 +00:00
* [lint] turn no-undef back on, set browser, cypress, and mocha env's, and fix issues * [lint] fix undefined var in TimeTable.jsx
51 lines
1.1 KiB
JavaScript
51 lines
1.1 KiB
JavaScript
import { expect } from 'chai';
|
|
|
|
import newComponentFactory from '../../../../src/dashboard/util/newComponentFactory';
|
|
|
|
import {
|
|
CHART_TYPE,
|
|
COLUMN_TYPE,
|
|
DASHBOARD_GRID_TYPE,
|
|
DASHBOARD_ROOT_TYPE,
|
|
DIVIDER_TYPE,
|
|
HEADER_TYPE,
|
|
MARKDOWN_TYPE,
|
|
NEW_COMPONENT_SOURCE_TYPE,
|
|
ROW_TYPE,
|
|
TABS_TYPE,
|
|
TAB_TYPE,
|
|
} from '../../../../src/dashboard/util/componentTypes';
|
|
|
|
const types = [
|
|
CHART_TYPE,
|
|
COLUMN_TYPE,
|
|
DASHBOARD_GRID_TYPE,
|
|
DASHBOARD_ROOT_TYPE,
|
|
DIVIDER_TYPE,
|
|
HEADER_TYPE,
|
|
MARKDOWN_TYPE,
|
|
NEW_COMPONENT_SOURCE_TYPE,
|
|
ROW_TYPE,
|
|
TABS_TYPE,
|
|
TAB_TYPE,
|
|
];
|
|
|
|
describe('newEntityFactory', () => {
|
|
types.forEach(type => {
|
|
it(`returns a new ${type}`, () => {
|
|
const result = newComponentFactory(type);
|
|
|
|
expect(result.type).to.equal(type);
|
|
expect(typeof result.id).to.equal('string');
|
|
expect(typeof result.meta).to.equal('object');
|
|
expect(Array.isArray(result.children)).to.equal(true);
|
|
});
|
|
});
|
|
|
|
it('adds passed meta data to the entity', () => {
|
|
const banana = 'banana';
|
|
const result = newComponentFactory(CHART_TYPE, { banana });
|
|
expect(result.meta.banana).to.equal(banana);
|
|
});
|
|
});
|