18 lines
1.0 KiB
TypeScript
18 lines
1.0 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
||
import { cardPropsEqual, type CardProps } from "./Card.tsx";
|
||
|
||
const node = { key: "A-1" } as CardProps["node"];
|
||
const base: CardProps = { node, box: { x: 1, y: 2, w: 240, h: 120 }, rel: undefined, multiSprint: false, sprintSel: new Set() };
|
||
|
||
describe("cardPropsEqual (T11.1)", () => {
|
||
it("новый объект box с теми же числами — карточка не перерисовывается", () => {
|
||
expect(cardPropsEqual(base, { ...base, box: { x: 1, y: 2, w: 240, h: 120 } })).toBe(true);
|
||
});
|
||
it("сдвиг, другая карточка или другой выбор спринтов — перерисовка", () => {
|
||
expect(cardPropsEqual(base, { ...base, box: { x: 9, y: 2, w: 240, h: 120 } })).toBe(false);
|
||
expect(cardPropsEqual(base, { ...base, node: { key: "A-2" } as CardProps["node"] })).toBe(false);
|
||
expect(cardPropsEqual(base, { ...base, sprintSel: new Set(["S"]) })).toBe(false);
|
||
expect(cardPropsEqual(base, { ...base, closed: true })).toBe(false);
|
||
});
|
||
});
|