mirror of
https://github.com/apache/superset.git
synced 2026-04-16 14:45:21 +00:00
[SIP-6] Add reactify function and convert world map to new directory structure. (#5893)
* reactify world map * add createAdaptor * fix typo * add schema * move directory * remove unnecessary lines * make setRef a function * convert keys to camelcase * add unit test * update formatting * add check for displayName * pass width and height as separate inputs
This commit is contained in:
committed by
Chris Williams
parent
75bc501146
commit
8fff0d9e8f
@@ -0,0 +1,29 @@
|
||||
import { it, describe } from 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import convertKeysToCamelCase from '../../../src/utils/convertKeysToCamelCase';
|
||||
|
||||
describe.only('convertKeysToCamelCase(object)', () => {
|
||||
it('returns undefined for undefined input', () => {
|
||||
expect(convertKeysToCamelCase(undefined)).to.equal(undefined);
|
||||
});
|
||||
it('returns null for null input', () => {
|
||||
expect(convertKeysToCamelCase(null)).to.equal(null);
|
||||
});
|
||||
it('returns a new object that has all keys in camelCase', () => {
|
||||
const input = {
|
||||
is_happy: true,
|
||||
'is-angry': false,
|
||||
isHungry: false,
|
||||
};
|
||||
expect(convertKeysToCamelCase(input)).to.deep.equal({
|
||||
isHappy: true,
|
||||
isAngry: false,
|
||||
isHungry: false,
|
||||
});
|
||||
});
|
||||
it('throws error if input is not a plain object', () => {
|
||||
expect(() => { convertKeysToCamelCase({}); }).to.not.throw();
|
||||
expect(() => { convertKeysToCamelCase(''); }).to.throw();
|
||||
expect(() => { convertKeysToCamelCase(new Map()); }).to.throw();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user