Files
superset2/superset/assets/spec/javascripts/dashboard/util/findParentId_spec.js
Chris Williams b453cd2bf2 [lint] turn no-undef back on, set browser, cypress, and mocha env's (#5879)
* [lint] turn no-undef back on, set browser, cypress, and mocha env's, and fix issues

* [lint] fix undefined var in TimeTable.jsx
2018-09-13 14:45:24 -07:00

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);
});
});