mirror of
https://github.com/apache/superset.git
synced 2026-04-11 12:26:05 +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
17 lines
539 B
JavaScript
17 lines
539 B
JavaScript
import { expect } from 'chai';
|
|
|
|
import sandboxedEval from '../../../src/modules/sandbox';
|
|
|
|
describe('sandboxedEval', () => {
|
|
it('works like a basic eval', () => {
|
|
expect(sandboxedEval('100')).to.equal(100);
|
|
expect(sandboxedEval('v => v * 2')(5)).to.equal(10);
|
|
});
|
|
it('d3 is in context and works', () => {
|
|
expect(sandboxedEval("l => _.find(l, s => s === 'bar')")(['foo', 'bar'])).to.equal('bar');
|
|
});
|
|
it('passes context as expected', () => {
|
|
expect(sandboxedEval('foo', { foo: 'bar' })).to.equal('bar');
|
|
});
|
|
});
|