import { isBase64Url } from "@hexclave/shared/dist/utils/bytes"; import { wait } from "@hexclave/shared/dist/utils/promises"; import { it } from "../../../../helpers"; import { Auth, InternalApiKey, InternalProjectKeys, Project, backendContext, niceBackendFetch } from "../../../backend-helpers"; // TODO some of the tests here test /api/v1/projects/current, the others test /api/v1/internal/projects/current. We should split them into different test files it("should not have access to the project without project keys", async ({ expect }) => { backendContext.set({ projectKeys: 'no-project' }); const response = await niceBackendFetch("/api/v1/internal/projects/current", { accessType: "client" }); expect(response).toMatchInlineSnapshot(` NiceResponse { "status": 400, "body": { "code": "ACCESS_TYPE_WITHOUT_PROJECT_ID", "details": { "request_type": "client" }, "error": deindent\` The x-hexclave-access-type header was 'client', but the x-hexclave-project-id header was not provided. (The legacy x-stack-access-type and x-stack-project-id headers are also accepted.) For more information, see the docs on REST API authentication: https://docs.hexclave.com/api/overview#authentication \`, }, "headers": Headers { "x-stack-known-error": "ACCESS_TYPE_WITHOUT_PROJECT_ID",