mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-11-08 13:05:08 +09:00
update tests as per comments
This commit is contained in:
1 parent
508640de61
commit
0bf885cc6b
1 file changed
+16
-10
@@ -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: [],
|
||||
},
|
||||
]);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user