mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-17 06:04:56 +00:00
Integrate OpenHandoff factory workspace (#212)
This commit is contained in:
parent
3d9476ed0b
commit
bf282199b5
251 changed files with 42824 additions and 692 deletions
52
factory/packages/backend/test/providers.test.ts
Normal file
52
factory/packages/backend/test/providers.test.ts
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
import { describe, expect, it } from "vitest";
|
||||
import { ConfigSchema, type AppConfig } from "@openhandoff/shared";
|
||||
import { createProviderRegistry } from "../src/providers/index.js";
|
||||
|
||||
function makeConfig(): AppConfig {
|
||||
return ConfigSchema.parse({
|
||||
auto_submit: true,
|
||||
notify: ["terminal"],
|
||||
workspace: { default: "default" },
|
||||
backend: {
|
||||
host: "127.0.0.1",
|
||||
port: 7741,
|
||||
dbPath: "~/.local/share/openhandoff/handoff.db",
|
||||
opencode_poll_interval: 2,
|
||||
github_poll_interval: 30,
|
||||
backup_interval_secs: 3600,
|
||||
backup_retention_days: 7
|
||||
},
|
||||
providers: {
|
||||
local: {},
|
||||
daytona: { image: "ubuntu:24.04" }
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
describe("provider registry", () => {
|
||||
it("defaults to local when daytona is not configured", () => {
|
||||
const registry = createProviderRegistry(makeConfig());
|
||||
expect(registry.defaultProviderId()).toBe("local");
|
||||
});
|
||||
|
||||
it("prefers daytona when an api key is configured", () => {
|
||||
const registry = createProviderRegistry(
|
||||
ConfigSchema.parse({
|
||||
...makeConfig(),
|
||||
providers: {
|
||||
...makeConfig().providers,
|
||||
daytona: {
|
||||
...makeConfig().providers.daytona,
|
||||
apiKey: "test-token",
|
||||
},
|
||||
},
|
||||
})
|
||||
);
|
||||
expect(registry.defaultProviderId()).toBe("daytona");
|
||||
});
|
||||
|
||||
it("returns the built-in provider", () => {
|
||||
const registry = createProviderRegistry(makeConfig());
|
||||
expect(registry.get("daytona").id()).toBe("daytona");
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue