mirror of
https://github.com/hanzoai/dev-desktop.git
synced 2026-11-23 05:52:02 +00:00
The web, server, and mobile clients already signed in through Hanzo IAM behind a Clerk-shaped adapter. Remove the Clerk configuration, appearance, load-failure screens and the dead Clerk branch of the CLI OAuth config; components/clerk is components/account. Co-authored-by: Hanzo Dev <[email protected]>
55 lines
1.8 KiB
TypeScript
55 lines
1.8 KiB
TypeScript
// @effect-diagnostics nodeBuiltinImport:off - Tests exercise root env file precedence directly.
|
|
import * as NodeFS from "node:fs";
|
|
import * as NodeOS from "node:os";
|
|
import * as NodePath from "node:path";
|
|
import { afterEach, describe, expect, it } from "vite-plus/test";
|
|
|
|
import { loadRepoEnv } from "./public-config.ts";
|
|
|
|
const temporaryDirectories: string[] = [];
|
|
|
|
afterEach(() => {
|
|
for (const directory of temporaryDirectories.splice(0)) {
|
|
NodeFS.rmSync(directory, { recursive: true, force: true });
|
|
}
|
|
});
|
|
|
|
describe("loadRepoEnv", () => {
|
|
it("applies process, root local, and root precedence in that order", () => {
|
|
const repoRoot = makeTemporaryDirectory();
|
|
NodeFS.writeFileSync(
|
|
NodePath.join(repoRoot, ".env"),
|
|
"HANZO_DEV_IAM_CLIENT_ID=iam_root\nHANZO_DEV_RELAY_URL=https://root.example.test\n",
|
|
);
|
|
NodeFS.writeFileSync(
|
|
NodePath.join(repoRoot, ".env.local"),
|
|
"HANZO_DEV_IAM_CLIENT_ID=iam_local\nHANZO_DEV_RELAY_URL=https://local.example.test\n",
|
|
);
|
|
|
|
expect(loadRepoEnv({ baseEnv: {}, repoRoot }).HANZO_DEV_RELAY_URL).toBe(
|
|
"https://local.example.test",
|
|
);
|
|
expect(
|
|
loadRepoEnv({
|
|
baseEnv: {
|
|
HANZO_DEV_IAM_CLIENT_ID: "iam_ci",
|
|
HANZO_DEV_RELAY_URL: "https://ci.example.test",
|
|
},
|
|
repoRoot,
|
|
}),
|
|
).toMatchObject({
|
|
HANZO_DEV_IAM_CLIENT_ID: "iam_ci",
|
|
VITE_HANZO_DEV_IAM_CLIENT_ID: "iam_ci",
|
|
EXPO_PUBLIC_HANZO_IAM_CLIENT_ID: "iam_ci",
|
|
HANZO_DEV_RELAY_URL: "https://ci.example.test",
|
|
VITE_HANZO_DEV_RELAY_URL: "https://ci.example.test",
|
|
});
|
|
});
|
|
});
|
|
|
|
function makeTemporaryDirectory() {
|
|
const directory = NodeFS.mkdtempSync(NodePath.join(NodeOS.tmpdir(), "hanzodev-public-config-"));
|
|
temporaryDirectories.push(directory);
|
|
return directory;
|
|
}
|