fix: address onboarding review feedback
This commit is contained in:
1 parent
dc71084323
commit
2566be2838
72 files changed
+7783
-280
No files matched your search
@@ -42,6 +42,12 @@ describe("onboarding URL validation", () => {
|
||||
name: "Sonarr",
|
||||
url: "http://sonarr:8989",
|
||||
pingUrl: "file:///etc/passwd",
|
||||
}).success,
|
||||
).toBe(false);
|
||||
expect(
|
||||
onboardingCreateIntegrationSchema.safeParse({
|
||||
name: "Sonarr",
|
||||
url: "http://sonarr:8989",
|
||||
description: "x".repeat(513),
|
||||
}).success,
|
||||
).toBe(false);
|
||||
@@ -78,4 +84,22 @@ describe("onboarding URL validation", () => {
|
||||
}).success,
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
test("accepts Docker source IDs up to 512 characters", () => {
|
||||
const input = {
|
||||
server: { defaultLocale: "en", defaultColorScheme: "dark" },
|
||||
board: {
|
||||
name: "dashboard",
|
||||
primaryColor: "#228BE6",
|
||||
secondaryColor: "#15AABF",
|
||||
itemRadius: "md",
|
||||
},
|
||||
selectedDockerSourceIds: ["x".repeat(512)],
|
||||
};
|
||||
|
||||
expect(onboardingCompleteSetupSchema.safeParse(input).success).toBe(true);
|
||||
expect(
|
||||
onboardingCompleteSetupSchema.safeParse({ ...input, selectedDockerSourceIds: ["x".repeat(513)] }).success,
|
||||
).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -17,10 +17,11 @@ const httpUrlSchema = z.url().refine((value) => {
|
||||
const protocol = new URL(value).protocol;
|
||||
return protocol === "http:" || protocol === "https:";
|
||||
}, "Only HTTP and HTTPS URLs are permitted");
|
||||
const uniqueIdsSchema = z
|
||||
.array(z.string().trim().min(1).max(255))
|
||||
.max(128)
|
||||
.refine((ids) => new Set(ids).size === ids.length, { message: "IDs must be unique" });
|
||||
const uniqueIdsSchema = (maxLength = 255) =>
|
||||
z
|
||||
.array(z.string().trim().min(1).max(maxLength))
|
||||
.max(128)
|
||||
.refine((ids) => new Set(ids).size === ids.length, { message: "IDs must be unique" });
|
||||
const sourceIdSchema = z.string().trim().min(1).max(512);
|
||||
|
||||
export const onboardingCreateIntegrationSchema = z.object({
|
||||
@@ -87,11 +88,11 @@ export const onboardingCompleteSetupSchema = z
|
||||
leftSidebar: z.boolean().default(false),
|
||||
rightSidebar: z.boolean().default(false),
|
||||
}),
|
||||
selectedIntegrationIds: uniqueIdsSchema.default([]),
|
||||
selectedAppIds: uniqueIdsSchema.default([]),
|
||||
selectedIntegrationIds: uniqueIdsSchema().default([]),
|
||||
selectedAppIds: uniqueIdsSchema().default([]),
|
||||
integrations: integrationDraftsSchema.default([]),
|
||||
apps: appDraftsSchema.default([]),
|
||||
selectedDockerSourceIds: uniqueIdsSchema.default([]),
|
||||
selectedDockerSourceIds: uniqueIdsSchema(512).default([]),
|
||||
selectedWidgetKinds: z
|
||||
.array(z.enum(widgetKinds))
|
||||
.max(widgetKinds.length)
|
||||
|
||||
Reference in new issue
Block a user