1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-11-01 19:07:38 +01:00
unleash.unleash/src/lib/util/snakeCase.test.ts
Fredrik Strand Oseberg 26c9d53b89
feat: Move environments to enterprise (#935)
- Adding, updating and renaming environments are meant to be
  enterprise only features, as such, this PR moves these operations out
  of this server

- We still keep sortOrder updating, toggling on/off and getting one,
  getting all, so we can still work with environments in the OSS version
  as well.

Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai>

Co-authored-by: Christopher Kolstad <chriswk@getunleash.ai>
2021-09-13 15:57:38 +02:00

26 lines
695 B
TypeScript

import { snakeCase, snakeCaseKeys } from './snakeCase';
test('should return snake case from camelCase', () => {
const resultOne = snakeCase('camelCase');
const resultTwo = snakeCase('SnaejKase');
expect(resultOne).toBe('camel_case');
expect(resultTwo).toBe('snaej_kase');
});
test('should return object with snake case keys', () => {
const input = {
sortOrder: 1,
type: 'production',
displayName: 'dev',
enabled: true,
};
const output = snakeCaseKeys(input);
expect(output.sort_order).toBe(1);
expect(output.type).toBe('production');
expect(output.display_name).toBe('dev');
expect(output.enabled).toBe(true);
});