mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-16 20:01:27 +00:00
parent
400f9a214e
commit
99abb9d42e
171 changed files with 7260 additions and 7342 deletions
|
|
@ -1,10 +1,10 @@
|
|||
import { describe, expect, it } from "vitest";
|
||||
import { ConfigSchema, resolveWorkspaceId, type AppConfig } from "../src/index.js";
|
||||
import { ConfigSchema, resolveOrganizationId, type AppConfig } from "../src/index.js";
|
||||
|
||||
const cfg: AppConfig = ConfigSchema.parse({
|
||||
auto_submit: true,
|
||||
notify: ["terminal"],
|
||||
workspace: { default: "team-a" },
|
||||
organization: { default: "team-a" },
|
||||
backend: {
|
||||
host: "127.0.0.1",
|
||||
port: 7741,
|
||||
|
|
@ -14,27 +14,27 @@ const cfg: AppConfig = ConfigSchema.parse({
|
|||
backup_interval_secs: 3600,
|
||||
backup_retention_days: 7,
|
||||
},
|
||||
providers: {
|
||||
sandboxProviders: {
|
||||
local: {},
|
||||
e2b: {},
|
||||
},
|
||||
});
|
||||
|
||||
describe("resolveWorkspaceId", () => {
|
||||
describe("resolveOrganizationId", () => {
|
||||
it("prefers explicit flag", () => {
|
||||
expect(resolveWorkspaceId("feature", cfg)).toBe("feature");
|
||||
expect(resolveOrganizationId("feature", cfg)).toBe("feature");
|
||||
});
|
||||
|
||||
it("falls back to config default", () => {
|
||||
expect(resolveWorkspaceId(undefined, cfg)).toBe("team-a");
|
||||
expect(resolveOrganizationId(undefined, cfg)).toBe("team-a");
|
||||
});
|
||||
|
||||
it("falls back to literal default when config value is empty", () => {
|
||||
const empty = {
|
||||
...cfg,
|
||||
workspace: { default: "" },
|
||||
organization: { default: "" },
|
||||
} as AppConfig;
|
||||
|
||||
expect(resolveWorkspaceId(undefined, empty)).toBe("default");
|
||||
expect(resolveOrganizationId(undefined, empty)).toBe("default");
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue