2022-08-19 10:10:36 +00:00
|
|
|
import { areArraysEqual, getCamelCaseString } from "utils/AppsmithUtils";
|
2021-12-09 12:02:47 +00:00
|
|
|
|
|
|
|
|
describe("getCamelCaseString", () => {
|
|
|
|
|
it("Should return a string in camelCase", () => {
|
|
|
|
|
const inputs = ["abcd", "ab12cd", "开关", "😃 😃 😃"];
|
|
|
|
|
const expected = ["abcd", "ab12Cd", "", ""];
|
|
|
|
|
|
|
|
|
|
inputs.forEach((input, index) => {
|
|
|
|
|
const result = getCamelCaseString(input);
|
|
|
|
|
expect(result).toStrictEqual(expected[index]);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
2022-08-19 10:10:36 +00:00
|
|
|
|
|
|
|
|
describe("test areArraysEqual", () => {
|
|
|
|
|
it("test areArraysEqual method", () => {
|
|
|
|
|
const OGArray = ["test1", "test2", "test3"];
|
|
|
|
|
|
|
|
|
|
let testArray: string[] = [];
|
|
|
|
|
expect(areArraysEqual(OGArray, testArray)).toBe(false);
|
|
|
|
|
|
|
|
|
|
testArray = ["test1", "test3"];
|
|
|
|
|
expect(areArraysEqual(OGArray, testArray)).toBe(false);
|
|
|
|
|
|
|
|
|
|
testArray = ["test1", "test2", "test3"];
|
|
|
|
|
expect(areArraysEqual(OGArray, testArray)).toBe(true);
|
|
|
|
|
|
|
|
|
|
testArray = ["test1", "test3", "test2"];
|
|
|
|
|
expect(areArraysEqual(OGArray, testArray)).toBe(true);
|
|
|
|
|
});
|
|
|
|
|
});
|