diff --git a/app/__test__/ui/client/utils/AppReduced.spec.ts b/app/__test__/ui/client/utils/AppReduced.spec.ts index 459272b..7afd838 100644 --- a/app/__test__/ui/client/utils/AppReduced.spec.ts +++ b/app/__test__/ui/client/utils/AppReduced.spec.ts @@ -1,6 +1,6 @@ import { describe, it, expect, beforeEach } from "vitest"; import { AppReduced, type AppType } from "ui/client/utils/AppReduced"; -import type { BkndAdminOptions } from "ui/client/BkndProvider"; +import type { BkndAdminProps } from "ui/Admin"; // Import the normalizeAdminPath function for testing // Note: This assumes the function is exported or we need to test it indirectly through public methods @@ -23,9 +23,9 @@ describe("AppReduced", () => { }); describe("getSettingsPath", () => { - it("should return settings path with admin_basepath", () => { - const options: BkndAdminOptions = { - admin_basepath: "/admin", + it("should return settings path with basepath", () => { + const options: BkndAdminProps["config"] = { + basepath: "/admin", logo_return_path: "/", }; @@ -35,9 +35,9 @@ describe("AppReduced", () => { expect(result).toBe("~/admin/settings"); }); - it("should return settings path with empty admin_basepath", () => { - const options: BkndAdminOptions = { - admin_basepath: "", + it("should return settings path with empty basepath", () => { + const options: BkndAdminProps["config"] = { + basepath: "", logo_return_path: "/", }; @@ -48,8 +48,8 @@ describe("AppReduced", () => { }); it("should append additional path segments", () => { - const options: BkndAdminOptions = { - admin_basepath: "/admin", + const options: BkndAdminProps["config"] = { + basepath: "/admin", logo_return_path: "/", }; @@ -60,8 +60,8 @@ describe("AppReduced", () => { }); it("should normalize multiple slashes", () => { - const options: BkndAdminOptions = { - admin_basepath: "//admin//", + const options: BkndAdminProps["config"] = { + basepath: "//admin//", logo_return_path: "/", }; @@ -71,9 +71,9 @@ describe("AppReduced", () => { expect(result).toBe("~/admin/settings/user"); }); - it("should handle admin_basepath without leading slash", () => { - const options: BkndAdminOptions = { - admin_basepath: "admin", + it("should handle basepath without leading slash", () => { + const options: BkndAdminProps["config"] = { + basepath: "admin", logo_return_path: "/", }; @@ -85,9 +85,9 @@ describe("AppReduced", () => { }); describe("getAbsolutePath", () => { - it("should return absolute path with admin_basepath", () => { - const options: BkndAdminOptions = { - admin_basepath: "/admin", + it("should return absolute path with basepath", () => { + const options: BkndAdminProps["config"] = { + basepath: "/admin", logo_return_path: "/", }; @@ -98,8 +98,8 @@ describe("AppReduced", () => { }); it("should return base path when no path provided", () => { - const options: BkndAdminOptions = { - admin_basepath: "/admin", + const options: BkndAdminProps["config"] = { + basepath: "/admin", logo_return_path: "/", }; @@ -110,8 +110,8 @@ describe("AppReduced", () => { }); it("should normalize paths correctly", () => { - const options: BkndAdminOptions = { - admin_basepath: "//admin//", + const options: BkndAdminProps["config"] = { + basepath: "//admin//", logo_return_path: "/", }; @@ -124,8 +124,8 @@ describe("AppReduced", () => { describe("options getter", () => { it("should return merged options with defaults", () => { - const customOptions: BkndAdminOptions = { - admin_basepath: "/custom-admin", + const customOptions: BkndAdminProps["config"] = { + basepath: "/custom-admin", logo_return_path: "/custom-home", }; @@ -135,27 +135,27 @@ describe("AppReduced", () => { expect(options).toEqual({ basepath: "/", logo_return_path: "/custom-home", - admin_basepath: "/custom-admin", + basepath: "/custom-admin", }); }); it("should use default logo_return_path when not provided", () => { - const customOptions: BkndAdminOptions = { - admin_basepath: "/admin", + const customOptions: BkndAdminProps["config"] = { + basepath: "/admin", }; appReduced = new AppReduced(mockAppJson, customOptions); const options = appReduced.options; expect(options.logo_return_path).toBe("/"); - expect(options.admin_basepath).toBe("/admin"); + expect(options.basepath).toBe("/admin"); }); }); describe("path normalization behavior", () => { it("should normalize duplicate slashes in settings path", () => { - const options: BkndAdminOptions = { - admin_basepath: "/admin", + const options: BkndAdminProps["config"] = { + basepath: "/admin", logo_return_path: "/", }; @@ -166,8 +166,8 @@ describe("AppReduced", () => { }); it("should handle root path normalization", () => { - const options: BkndAdminOptions = { - admin_basepath: "/", + const options: BkndAdminProps["config"] = { + basepath: "/", logo_return_path: "/", }; @@ -175,13 +175,13 @@ describe("AppReduced", () => { const result = appReduced.getAbsolutePath(); // The normalizeAdminPath function removes trailing slashes except for root "/" - // When admin_basepath is "/", the result is "~/" which becomes "~" after normalization + // When basepath is "/", the result is "~/" which becomes "~" after normalization expect(result).toBe("~"); }); it("should preserve entity paths ending with slash", () => { - const options: BkndAdminOptions = { - admin_basepath: "/admin", + const options: BkndAdminProps["config"] = { + basepath: "/admin", logo_return_path: "/", }; @@ -192,8 +192,8 @@ describe("AppReduced", () => { }); it("should remove trailing slashes from non-entity paths", () => { - const options: BkndAdminOptions = { - admin_basepath: "/admin", + const options: BkndAdminProps["config"] = { + basepath: "/admin", logo_return_path: "/", }; @@ -205,21 +205,21 @@ describe("AppReduced", () => { }); describe("edge cases", () => { - it("should handle undefined admin_basepath", () => { - const options: BkndAdminOptions = { + it("should handle undefined basepath", () => { + const options: BkndAdminProps["config"] = { logo_return_path: "/", }; appReduced = new AppReduced(mockAppJson, options); const result = appReduced.getSettingsPath(); - // When admin_basepath is undefined, it defaults to empty string + // When basepath is undefined, it defaults to empty string expect(result).toBe("~/settings"); }); it("should handle null path segments", () => { - const options: BkndAdminOptions = { - admin_basepath: "/admin", + const options: BkndAdminProps["config"] = { + basepath: "/admin", logo_return_path: "/", };