Merge custom option test fix into mobile boards
This commit is contained in:
32 files changed
+798
-238
No files matched your search
@@ -71,17 +71,16 @@ describe("lean Custom Widget options", () => {
|
||||
});
|
||||
|
||||
it("replaces stale values with current defaults", () => {
|
||||
const options = customWidgetDefinitionSchema.parse({
|
||||
$schema: "homarr-custom-widget-v2",
|
||||
name: "Updated options",
|
||||
sources: {},
|
||||
requests: {},
|
||||
options: {
|
||||
limit: { label: "Limit", control: "slider", default: 5, min: 1, max: 10 },
|
||||
label: { label: "Label", control: "text", default: "Default" },
|
||||
},
|
||||
template: "<Text>{options.limit}</Text>",
|
||||
}).options;
|
||||
const options = {
|
||||
limit: customWidgetOptionSchema.parse({
|
||||
label: "Limit",
|
||||
control: "slider",
|
||||
default: 5,
|
||||
min: 1,
|
||||
max: 10,
|
||||
}),
|
||||
label: customWidgetOptionSchema.parse({ label: "Label", control: "text", default: "Default" }),
|
||||
};
|
||||
|
||||
const normalized = normalizeCustomWidgetOptions(options, {
|
||||
limit: "5",
|
||||
|
||||
@@ -6,7 +6,7 @@ import { integrationDefs } from "../integration";
|
||||
|
||||
describe("Icon url's of integrations should be valid and return 200", () => {
|
||||
objectEntries(integrationDefs).forEach(([integration, { iconUrl }]) => {
|
||||
it.concurrent(`should return 200 for ${integration}`, async () => {
|
||||
it(`should return 200 for ${integration}`, { concurrent: true, retry: 2, timeout: 15_000 }, async () => {
|
||||
const res = await fetch(iconUrl);
|
||||
expect(res.status).toBe(200);
|
||||
});
|
||||
|
||||
@@ -88,8 +88,16 @@ describe("section behavior validation", () => {
|
||||
});
|
||||
});
|
||||
|
||||
test.each(["category", "dynamic"])("rejects the legacy %s kind", (kind) => {
|
||||
expect(() => sectionSchema.parse({ id: "legacy", kind, layouts: [] })).toThrow();
|
||||
test("normalizes the legacy dynamic kind to a container", () => {
|
||||
expect(sectionSchema.parse({ id: "legacy", kind: "dynamic", layouts: [] })).toMatchObject({
|
||||
id: "legacy",
|
||||
kind: "container",
|
||||
layouts: [],
|
||||
});
|
||||
});
|
||||
|
||||
test("rejects the legacy category kind", () => {
|
||||
expect(() => sectionSchema.parse({ id: "legacy", kind: "category", layouts: [] })).toThrow();
|
||||
});
|
||||
|
||||
test.each([
|
||||
|
||||
@@ -93,4 +93,8 @@ const containerSectionSchema = z.object({
|
||||
),
|
||||
});
|
||||
|
||||
export const sectionSchema = z.union([emptySectionSchema, containerSectionSchema]);
|
||||
const legacyDynamicSectionSchema = containerSectionSchema
|
||||
.extend({ kind: z.literal("dynamic") })
|
||||
.transform((section) => ({ ...section, kind: "container" as const }));
|
||||
|
||||
export const sectionSchema = z.union([emptySectionSchema, containerSectionSchema, legacyDynamicSectionSchema]);
|
||||
@@ -10,7 +10,6 @@ const advancedFocusWidgetKinds = [
|
||||
"bookmarks",
|
||||
"calendar",
|
||||
"clock",
|
||||
"dockerContainers",
|
||||
"downloads",
|
||||
"firewall",
|
||||
"healthMonitoring",
|
||||
|
||||
@@ -25,7 +25,6 @@ const columnTranslationKeyMap = {
|
||||
|
||||
export const { definition, componentLoader } = createWidgetDefinition("dockerContainers", {
|
||||
icon: IconBrandDocker,
|
||||
supportsAdvancedFocus: true,
|
||||
queryKey: [["docker", "getContainers"]],
|
||||
refetchInterval: 30,
|
||||
createOptions() {
|
||||
|
||||
Reference in new issue
Block a user