openpanel/packages/hasura/test/utils/upperCaseValues.spec.ts
Stefan Pejcic 8595a9f4e5 back
2024-05-08 19:58:53 +02:00

25 lines
713 B
TypeScript

import { upperCaseValues } from "../../src/utils";
describe("upperCaseValues", () => {
it("should return undefined if the input object is undefined or null", () => {
expect(upperCaseValues(undefined)).toBeUndefined();
expect(upperCaseValues(null)).toBeUndefined();
});
it("should return an object with all its string values converted to upper case", () => {
const input = {
key1: "value1",
key2: "value2",
key3: "value3",
};
const expectedOutput = {
key1: "VALUE1",
key2: "VALUE2",
key3: "VALUE3",
};
expect(upperCaseValues(input)).toEqual(expectedOutput);
});
});