mirror of
https://github.com/apache/superset.git
synced 2026-04-20 08:34:37 +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
29 lines
673 B
JavaScript
29 lines
673 B
JavaScript
import { expect } from 'chai';
|
|
|
|
import findParentId from '../../../../src/dashboard/util/findParentId';
|
|
|
|
describe('findParentId', () => {
|
|
const layout = {
|
|
a: {
|
|
id: 'a',
|
|
children: ['b', 'r', 'k'],
|
|
},
|
|
b: {
|
|
id: 'b',
|
|
children: ['x', 'y', 'z'],
|
|
},
|
|
z: {
|
|
id: 'z',
|
|
children: [],
|
|
},
|
|
};
|
|
it('should return the correct parentId', () => {
|
|
expect(findParentId({ childId: 'b', layout })).to.equal('a');
|
|
expect(findParentId({ childId: 'z', layout })).to.equal('b');
|
|
});
|
|
|
|
it('should return null if the parent cannot be found', () => {
|
|
expect(findParentId({ childId: 'a', layout })).to.equal(null);
|
|
});
|
|
});
|