mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
Rename color constants and move util function into separate file (#6074)
* rename constant colors to UPPERCASE * Move isDefined into its own file and add unit test
This commit is contained in:
committed by
Grace Guo
parent
c0f685b640
commit
64383ce96e
22
superset/assets/spec/javascripts/utils/isDefined_spec.js
Normal file
22
superset/assets/spec/javascripts/utils/isDefined_spec.js
Normal file
@@ -0,0 +1,22 @@
|
||||
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);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user