openpanel/packages/hasura/test/utils/camelizaKeys.spec.ts
Stefan Pejcic 09f9f9502d packages
2024-11-07 19:03:37 +01:00

30 lines
675 B
TypeScript

import { camelizeKeys } from "../../src/utils";
describe("camelizeKeys", () => {
it("should return undefined if the input is undefined", () => {
const result = camelizeKeys(undefined);
expect(result).toBeUndefined();
});
it("should return an object with camelCase keys", () => {
const input = {
first_key: "value1",
second_key: "value2",
third_key: {
inner_key: "value3",
},
};
const expectedResult = {
firstKey: "value1",
secondKey: "value2",
thirdKey: {
inner_key: "value3",
},
};
const result = camelizeKeys(input);
expect(result).toEqual(expectedResult);
});
});