mirror of
https://github.com/apache/superset.git
synced 2026-04-10 20:06:13 +00:00
18 lines
577 B
JavaScript
18 lines
577 B
JavaScript
import { it, describe } from 'mocha';
|
|
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');
|
|
});
|
|
});
|