mirror of
https://github.com/apache/superset.git
synced 2026-04-22 17:45:21 +00:00
* rename constant colors to UPPERCASE * Move isDefined into its own file and add unit test
23 lines
809 B
JavaScript
23 lines
809 B
JavaScript
import { it, describe } from 'mocha';
|
|
import { expect } from 'chai';
|
|
import isDefined from '../../../src/utils/isDefined';
|
|
|
|
describe('isDefined(value)', () => {
|
|
it('returns true if value is not null and not undefined', () => {
|
|
expect(isDefined(0)).to.equal(true);
|
|
expect(isDefined(1)).to.equal(true);
|
|
expect(isDefined('')).to.equal(true);
|
|
expect(isDefined('a')).to.equal(true);
|
|
expect(isDefined([])).to.equal(true);
|
|
expect(isDefined([0])).to.equal(true);
|
|
expect(isDefined([1])).to.equal(true);
|
|
expect(isDefined({})).to.equal(true);
|
|
expect(isDefined({ a: 1 })).to.equal(true);
|
|
expect(isDefined([{}])).to.equal(true);
|
|
});
|
|
it('returns false otherwise', () => {
|
|
expect(isDefined(null)).to.equal(false);
|
|
expect(isDefined(undefined)).to.equal(false);
|
|
});
|
|
});
|