mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-11-09 14:03:33 +09:00
21 lines
615 B
TypeScript
21 lines
615 B
TypeScript
import { cloneProps } from "./clone-props";
|
|
|
|
describe("Clone props", () => {
|
|
test("update ids", () => {
|
|
const instanceProps = {
|
|
props: [{ id: "1", prop: "a", value: "1" }],
|
|
id: "id",
|
|
instanceId: "instanceId",
|
|
treeId: "treeId",
|
|
};
|
|
|
|
const clonedProps = cloneProps(instanceProps, {
|
|
instanceId: "newInstanceId",
|
|
});
|
|
expect(clonedProps.id).not.toBe(instanceProps.id);
|
|
expect(clonedProps.instanceId).toBe("newInstanceId");
|
|
expect(clonedProps.treeId).toBe(instanceProps.treeId);
|
|
expect(clonedProps.props[0].id).not.toBe(instanceProps.props[0].id);
|
|
});
|
|
});
|