mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-11-08 21:15:18 +09:00
47 lines
1.2 KiB
TypeScript
47 lines
1.2 KiB
TypeScript
import { type AllUserProps } from "@webstudio-is/sdk";
|
|
import { deletePropMutable } from "./delete-prop";
|
|
|
|
describe("Delete prop", () => {
|
|
test("found and deleted", () => {
|
|
const propsMap: AllUserProps = {
|
|
instanceId: {
|
|
id: "id",
|
|
instanceId: "instanceId",
|
|
treeId: "treeId",
|
|
props: [
|
|
{ id: "propId", prop: "b", value: "1" },
|
|
{ id: "propId1", prop: "a", value: "1" },
|
|
],
|
|
},
|
|
};
|
|
|
|
const isDeleted = deletePropMutable(propsMap, {
|
|
instanceId: "instanceId",
|
|
propId: "propId",
|
|
});
|
|
expect(propsMap).toMatchSnapshot();
|
|
expect(isDeleted).toBeTruthy();
|
|
});
|
|
|
|
test("not found and not deleted", () => {
|
|
const propsMap: AllUserProps = {
|
|
instanceId: {
|
|
id: "id",
|
|
instanceId: "instanceId",
|
|
treeId: "treeId",
|
|
props: [
|
|
{ id: "propId", prop: "b", value: "1" },
|
|
{ id: "propId1", prop: "a", value: "1" },
|
|
],
|
|
},
|
|
};
|
|
|
|
const isDeleted = deletePropMutable(propsMap, {
|
|
instanceId: "instanceId",
|
|
propId: "notFound",
|
|
});
|
|
expect(propsMap).toMatchSnapshot();
|
|
expect(isDeleted).toBeFalsy();
|
|
});
|
|
});
|