Reorganize repo structure and standards references
This commit is contained in:
1 parent
3cb93a81be
commit
be2054274d
5885 files changed
+2588
-195
No files matched your search
@@ -0,0 +1,31 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import canonicalUrlUtils, {
|
||||
adminPath,
|
||||
adminUrl,
|
||||
apiPath,
|
||||
apiUrl,
|
||||
appPath,
|
||||
appUrl,
|
||||
} from "./canonical.js";
|
||||
|
||||
import type { AppPathOptions, CanonicalUrlMode } from "./canonical.js";
|
||||
|
||||
describe("@toolctrl/url canonical exports", () => {
|
||||
it("exports canonical helpers and the default helper object", () => {
|
||||
expect(appPath({ tenantSlug: "acme" })).toBe("/acme");
|
||||
expect(adminPath("users")).toBe("/users");
|
||||
expect(apiPath("health")).toBe("/v1/health");
|
||||
expect(appUrl({ rootDomain: "example.com", tenantSlug: "acme" })).toBe("https://example.com/acme");
|
||||
expect(adminUrl({ rootDomain: "example.com", path: "users" })).toBe("https://example.com/users");
|
||||
expect(apiUrl({ rootDomain: "example.com", path: "health" })).toBe("https://example.com/v1/health");
|
||||
expect(canonicalUrlUtils).toMatchObject({ appPath, adminPath, apiPath, appUrl, adminUrl, apiUrl });
|
||||
});
|
||||
|
||||
it("keeps public types importable", () => {
|
||||
const mode: CanonicalUrlMode = "host-aware";
|
||||
const options: AppPathOptions = { tenantSlug: "acme", mode };
|
||||
|
||||
expect(appPath(options)).toBe("/acme");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user