mirror of
https://github.com/bendtherules/opencode-multi-model.git
synced 2026-08-18 13:42:21 +00:00
refactor: rename launchMultiModel to openMultiModel
This commit is contained in:
+18
-18
@@ -1,7 +1,7 @@
|
||||
import { expect, test, mock, spyOn, beforeEach, afterEach, describe } from "bun:test";
|
||||
import * as fs from "node:fs";
|
||||
import * as os from "node:os";
|
||||
import { launchMultiModel } from "../src/core/open";
|
||||
import { openMultiModel } from "../src/core/open";
|
||||
import {
|
||||
shellQuote,
|
||||
normalizeModels,
|
||||
@@ -79,7 +79,7 @@ describe("multi-model launch", () => {
|
||||
});
|
||||
|
||||
test("fails if session name is empty", async () => {
|
||||
const result = await launchMultiModel({
|
||||
const result = await openMultiModel({
|
||||
sessionName: "",
|
||||
models: ["openai/gpt-5.2"],
|
||||
});
|
||||
@@ -90,7 +90,7 @@ describe("multi-model launch", () => {
|
||||
});
|
||||
|
||||
test("fails if no models are provided", async () => {
|
||||
const result = await launchMultiModel({
|
||||
const result = await openMultiModel({
|
||||
sessionName: "test-session",
|
||||
models: [],
|
||||
});
|
||||
@@ -101,7 +101,7 @@ describe("multi-model launch", () => {
|
||||
});
|
||||
|
||||
test("fails if duplicate models are provided", async () => {
|
||||
const result = await launchMultiModel({
|
||||
const result = await openMultiModel({
|
||||
sessionName: "test-session",
|
||||
models: ["openai/gpt-5.2", "openai/gpt-5.2"],
|
||||
});
|
||||
@@ -114,7 +114,7 @@ describe("multi-model launch", () => {
|
||||
test("fails if not inside a git repository", async () => {
|
||||
mockCommandResponses["git rev-parse --is-inside-work-tree"] = { ok: false, stdout: "", stderr: "not a git repo" };
|
||||
|
||||
const result = await launchMultiModel({
|
||||
const result = await openMultiModel({
|
||||
sessionName: "test-session",
|
||||
models: ["openai/gpt-5.2"],
|
||||
});
|
||||
@@ -127,7 +127,7 @@ describe("multi-model launch", () => {
|
||||
test("fails if tmux is not installed", async () => {
|
||||
mockCommandResponses["command -v tmux"] = { ok: false, stdout: "", stderr: "" };
|
||||
|
||||
const result = await launchMultiModel({
|
||||
const result = await openMultiModel({
|
||||
sessionName: "test-session",
|
||||
models: ["openai/gpt-5.2"],
|
||||
});
|
||||
@@ -143,7 +143,7 @@ describe("multi-model launch", () => {
|
||||
test("fails if opencode is not installed", async () => {
|
||||
mockCommandResponses["command -v opencode"] = { ok: false, stdout: "", stderr: "" };
|
||||
|
||||
const result = await launchMultiModel({
|
||||
const result = await openMultiModel({
|
||||
sessionName: "test-session",
|
||||
models: ["openai/gpt-5.2"],
|
||||
});
|
||||
@@ -158,7 +158,7 @@ describe("multi-model launch", () => {
|
||||
});
|
||||
|
||||
test("fails if model name is not in allowlist", async () => {
|
||||
const result = await launchMultiModel({
|
||||
const result = await openMultiModel({
|
||||
sessionName: "test-session",
|
||||
models: ["invalid/model"],
|
||||
});
|
||||
@@ -176,7 +176,7 @@ describe("multi-model launch", () => {
|
||||
test("fails if session already exists", async () => {
|
||||
mockCommandResponses["tmux has-session -t test-session"] = { ok: true, stdout: "", stderr: "" };
|
||||
|
||||
const result = await launchMultiModel({
|
||||
const result = await openMultiModel({
|
||||
sessionName: "test-session",
|
||||
models: ["openai/gpt-5.2"],
|
||||
});
|
||||
@@ -193,7 +193,7 @@ describe("multi-model launch", () => {
|
||||
});
|
||||
|
||||
test("successfully plans and executes tmux launch with single model", async () => {
|
||||
const result = await launchMultiModel({
|
||||
const result = await openMultiModel({
|
||||
sessionName: "test-session",
|
||||
models: ["openai/gpt-5.2"],
|
||||
});
|
||||
@@ -207,7 +207,7 @@ describe("multi-model launch", () => {
|
||||
test("successfully launches multiple models", async () => {
|
||||
mockCommandResponses["git show-ref --verify --quiet refs/heads/opencode/test-session/claude-3-5-sonnet"] = { ok: false, stdout: "", stderr: "" };
|
||||
|
||||
const result = await launchMultiModel({
|
||||
const result = await openMultiModel({
|
||||
sessionName: "test-session",
|
||||
models: ["openai/gpt-5.2", "anthropic/claude-3-5-sonnet"],
|
||||
});
|
||||
@@ -222,7 +222,7 @@ describe("multi-model launch", () => {
|
||||
mockCommandResponses["tmux has-session -t test session!"] = { ok: false, stdout: "", stderr: "" };
|
||||
mockCommandResponses["git show-ref --verify --quiet refs/heads/opencode/test-session/gpt-5-2"] = { ok: false, stdout: "", stderr: "" };
|
||||
|
||||
const result = await launchMultiModel({
|
||||
const result = await openMultiModel({
|
||||
sessionName: "test session!",
|
||||
models: ["openai/gpt-5.2"],
|
||||
});
|
||||
@@ -237,7 +237,7 @@ describe("multi-model launch", () => {
|
||||
mockCommandResponses["git worktree remove -f /mock/home/.local/share/opencode/multi-model/test-session/gpt-5-2"] = { ok: true, stdout: "", stderr: "" };
|
||||
mockCommandResponses["git branch -D opencode/test-session/gpt-5-2"] = { ok: true, stdout: "", stderr: "" };
|
||||
|
||||
const result = await launchMultiModel({
|
||||
const result = await openMultiModel({
|
||||
sessionName: "test-session",
|
||||
models: ["openai/gpt-5.2"],
|
||||
});
|
||||
@@ -263,7 +263,7 @@ describe("multi-model launch", () => {
|
||||
return path.includes("test-session/gpt-5-2");
|
||||
});
|
||||
|
||||
const result = await launchMultiModel({
|
||||
const result = await openMultiModel({
|
||||
sessionName: "test-session",
|
||||
models: ["openai/gpt-5.2"],
|
||||
});
|
||||
@@ -282,7 +282,7 @@ describe("multi-model launch", () => {
|
||||
test("fails if git branch exists for first model", async () => {
|
||||
mockCommandResponses["git show-ref --verify --quiet refs/heads/opencode/test-session/gpt-5-2"] = { ok: true, stdout: "", stderr: "" };
|
||||
|
||||
const result = await launchMultiModel({
|
||||
const result = await openMultiModel({
|
||||
sessionName: "test-session",
|
||||
models: ["openai/gpt-5.2"],
|
||||
});
|
||||
@@ -302,7 +302,7 @@ describe("multi-model launch", () => {
|
||||
test("fails if git worktree add fails for first model", async () => {
|
||||
mockCommandResponses["git worktree add -b opencode/test-session/gpt-5-2 /mock/home/.local/share/opencode/multi-model/test-session/gpt-5-2"] = { ok: false, stdout: "", stderr: "git error" };
|
||||
|
||||
const result = await launchMultiModel({
|
||||
const result = await openMultiModel({
|
||||
sessionName: "test-session",
|
||||
models: ["openai/gpt-5.2"],
|
||||
});
|
||||
@@ -325,7 +325,7 @@ describe("multi-model launch", () => {
|
||||
mockCommandResponses["git show-ref --verify --quiet refs/heads/opencode/test-session/gpt-5-2"] = { ok: false, stdout: "", stderr: "" };
|
||||
mockCommandResponses["git show-ref --verify --quiet refs/heads/opencode/test-session/gpt-5-2-2"] = { ok: false, stdout: "", stderr: "" };
|
||||
|
||||
const result = await launchMultiModel({
|
||||
const result = await openMultiModel({
|
||||
sessionName: "test-session",
|
||||
models: ["openai/gpt-5.2", "anthropic/gpt-5.2"],
|
||||
});
|
||||
@@ -341,7 +341,7 @@ describe("multi-model launch", () => {
|
||||
mockCommandResponses["opencode models"] = { ok: true, stdout: longModel, stderr: "" };
|
||||
mockCommandResponses[`git show-ref --verify --quiet refs/heads/opencode/test-session/${longModel.slice(0, 24)}`] = { ok: false, stdout: "", stderr: "" };
|
||||
|
||||
const result = await launchMultiModel({
|
||||
const result = await openMultiModel({
|
||||
sessionName: "test-session",
|
||||
models: [longModel],
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user