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.

fix: tests + types

Andras Bacsai4dfe5d1b848f
diff --git a/packages/http-client/src/index.d.ts b/packages/http-client/src/index.d.ts
index 4396bfac27..5d7771e3d9 100644
--- a/packages/http-client/src/index.d.ts
+++ b/packages/http-client/src/index.d.ts
@@ -11,11 +11,9 @@ export type Page = {
export type Project = {
[string]: {
page: Page;
- tree: BaseInstance & { errors: string };
- props: Array<UserProp> & { errors: string };
- breakpoints: Array<Breakpoint> & {
- errors: string;
- };
+ tree: BaseInstance | null;
+ props: Array<UserProp> | [];
+ breakpoints: Array<Breakpoint> | null;
css: string;
};
};
diff --git a/packages/http-client/src/index.test.ts b/packages/http-client/src/index.test.ts
index 20c4c526e8..cb372d45fa 100644
--- a/packages/http-client/src/index.test.ts
+++ b/packages/http-client/src/index.test.ts
@@ -1,9 +1,10 @@
import { loadProject } from "./index";
-const existingProjectId = "40c7a865-0bc7-4012-9318-6c4c665425de";
+const existingProjectId = "675e8af3-48fa-4b18-9ebf-fd2b128865e2";
const notPublishedProjectId = "7ec397c6-b3d0-4967-9073-9d83623fcf8e";
-const onlyHomeProjectId = "1e60b0be-afba-4c8d-9956-5a5b7963e4dc";
-const morePagesProjectId = "40c7a865-0bc7-4012-9318-6c4c665425de";
+const onlyHomeProjectId = "36d6c16f-04a0-45d4-ab1d-aa0ab61eb5b6";
+const morePagesProjectId = existingProjectId;
+
const apiUrl = "http://localhost:3000";
describe("getProjectDetails", () => {
@@ -12,14 +13,14 @@ describe("getProjectDetails", () => {
apiUrl,
projectId: morePagesProjectId,
});
- expect(Object.keys(response).length > 1).toBeTruthy();
+ expect(Object.keys(response.pages).length > 1).toBeTruthy();
});
test("does not include pages", async () => {
const response = await loadProject({
apiUrl,
projectId: onlyHomeProjectId,
});
- expect(Object.keys(response).length === 1).toBeTruthy();
+ expect(Object.keys(response.pages).length === 1).toBeTruthy();
});
test("loads existing project", async () => {
const response = await loadProject({
@@ -33,8 +34,8 @@ describe("getProjectDetails", () => {
apiUrl,
projectId: notPublishedProjectId,
});
- expect(response).toBe(
- `Project ${notPublishedProjectId} needs to be published first`
+ expect(response.toString()).toBe(
+ "Error: Project not found or not published yet. Please contact us to get help."
);
});
});