Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

update tests as per comments

piyush arora0bf885cc6b32
diff --git a/app/shared/tree-utils/create-instance.test.ts b/app/shared/tree-utils/create-instance.test.ts
index 70e738502e..c9501b05ac 100644
--- a/app/shared/tree-utils/create-instance.test.ts
+++ b/app/shared/tree-utils/create-instance.test.ts
@@ -4,29 +4,28 @@ describe("create instance", () => {
test("instance without id should be auto generated", () => {
const createdInstance = createInstance({
component: "Box",
- id: undefined,
- children: [],
- style: {},
});
- // We cannot do snapshot testing here as the id will always be unique
- expect(createdInstance.id).toBeDefined();
+ expect(typeof createdInstance.id).toBe("string");
});
test("instance without children should be empty by default", () => {
const createdInstance = createInstance({
component: "Box",
- id: undefined,
- children: undefined,
- style: {},
});
expect(createdInstance.children.length).toBe(0);
});
+ test("instance without style should be an object after creation", () => {
+ const createdInstance = createInstance({
+ component: "Box",
+ });
+ expect(typeof createdInstance.style).toBe("object");
+ });
+
test("instance with children ", () => {
const createdInstance = createInstance({
component: "Box",
- id: undefined,
children: [
{
id: "1",
@@ -37,6 +36,13 @@ describe("create instance", () => {
],
style: {},
});
- expect(createdInstance.children.length).toBe(1);
+ expect(createdInstance.children).toEqual([
+ {
+ id: "1",
+ component: "Box",
+ style: {},
+ children: [],
+ },
+ ]);
});
});