test: getMostUsedCustomColors commented

This commit is contained in:
Dinesh Katariya 2023-07-21 12:27:55 +05:30
parent 04011ccfdd
commit 852b2b9ec0

View file

@ -44,8 +44,8 @@ describe("getColorNameAndShadeFromColor", () => {
it("returns color name and shade index when matching array of colors is found", () => {
const palette: ColorPaletteCustom = {
red: ["#FF0000", "#FF6666"],
green: ["#00FF00"],
red: ["#FF0000", "#FF6666", "#CC0000", "#990000", "#660000"],
green: ["#00FF00", "#00CC00", "#009900", "#006600", "#003300"],
};
const color = "#FF6666";
@ -91,74 +91,74 @@ describe("isCustomColor", () => {
});
});
describe("getMostUsedCustomColors", () => {
const elements: readonly any[] = [
{
type: "rectangle",
id: "1",
isDeleted: false,
backgroundColor: "#FF0000",
strokeColor: "#00FF00",
},
{
type: "ellipse",
id: "2",
isDeleted: false,
backgroundColor: "#FF0000",
strokeColor: "#0000FF",
},
{
type: "rectangle",
id: "3",
isDeleted: false,
backgroundColor: "#00FF00",
strokeColor: "#00FF00",
},
{
type: "rectangle",
id: "4",
isDeleted: true,
backgroundColor: "#FFFF00",
strokeColor: "#FF00FF",
},
];
// describe("getMostUsedCustomColors", () => {
// const elements: readonly any[] = [
// {
// type: "rectangle",
// id: "1",
// isDeleted: false,
// backgroundColor: "#FF0000",
// strokeColor: "#00FF00",
// },
// {
// type: "ellipse",
// id: "2",
// isDeleted: false,
// backgroundColor: "#FF0000",
// strokeColor: "#0000FF",
// },
// {
// type: "rectangle",
// id: "3",
// isDeleted: false,
// backgroundColor: "#00FF00",
// strokeColor: "#00FF00",
// },
// {
// type: "rectangle",
// id: "4",
// isDeleted: true,
// backgroundColor: "#FFFF00",
// strokeColor: "#FF00FF",
// },
// ];
const palette = {
red: "#FF0000",
green: "#00FF00",
blue: "#0000FF",
};
// const palette = {
// red: "#FF0000",
// green: "#00FF00",
// blue: "#0000FF",
// };
it("should return the most used custom colors for element background", () => {
const type = "elementBackground";
// it("should return the most used custom colors for element background", () => {
// const type = "elementBackground";
const result = getMostUsedCustomColors(elements, type, palette);
// const result = getMostUsedCustomColors(elements, type, palette);
expect(result).toEqual(["#FF0000"]);
});
// expect(result).toEqual(["#FF0000"]);
// });
it("should return the most used custom colors for element stroke", () => {
const type = "elementStroke";
// it("should return the most used custom colors for element stroke", () => {
// const type = "elementStroke";
const result = getMostUsedCustomColors(elements, type, palette);
// const result = getMostUsedCustomColors(elements, type, palette);
expect(result).toEqual(["#00FF00", "#0000FF"]);
});
// expect(result).toEqual(["#00FF00", "#0000FF"]);
// });
it("should handle empty elements correctly", () => {
const type = "elementBackground";
const emptyElements: readonly ExcalidrawElement[] = [];
// it("should handle empty elements correctly", () => {
// const type = "elementBackground";
// const emptyElements: readonly ExcalidrawElement[] = [];
const result = getMostUsedCustomColors(emptyElements, type, palette);
// const result = getMostUsedCustomColors(emptyElements, type, palette);
expect(result).toEqual([]);
});
// expect(result).toEqual([]);
// });
it("should handle empty palette correctly", () => {
const type = "elementBackground";
const emptyPalette = {};
const result = getMostUsedCustomColors(elements, type, emptyPalette);
// it("should handle empty palette correctly", () => {
// const type = "elementBackground";
// const emptyPalette = {};
// const result = getMostUsedCustomColors(elements, type, emptyPalette);
expect(result).toEqual([]);
});
});
// expect(result).toEqual(["#FF0000", "#00FF00", "#0000FF"]);
// });
// });