mirror of
https://github.com/getpaseo/paseo.git
synced 2026-07-29 12:01:31 +00:00
test(server): align worktree tests with explicit PR context
This commit is contained in:
@@ -562,7 +562,7 @@ test("omitting create_agent_request worktree base-ref fields preserves legacy wi
|
|||||||
await expect(createPromise).rejects.toThrow("legacy git shape sentinel");
|
await expect(createPromise).rejects.toThrow("legacy git shape sentinel");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("sends structured attachments with create_paseo_worktree_request", async () => {
|
test("sends structured first-agent context attachments with create_paseo_worktree_request", async () => {
|
||||||
const logger = createMockLogger();
|
const logger = createMockLogger();
|
||||||
const mock = createMockTransport();
|
const mock = createMockTransport();
|
||||||
|
|
||||||
@@ -582,15 +582,17 @@ test("sends structured attachments with create_paseo_worktree_request", async ()
|
|||||||
const createPromise = client.createPaseoWorktree({
|
const createPromise = client.createPaseoWorktree({
|
||||||
cwd: "/tmp/project",
|
cwd: "/tmp/project",
|
||||||
worktreeSlug: "review-pr-123",
|
worktreeSlug: "review-pr-123",
|
||||||
attachments: [
|
firstAgentContext: {
|
||||||
{
|
attachments: [
|
||||||
type: "github_pr",
|
{
|
||||||
mimeType: "application/github-pr",
|
type: "github_pr",
|
||||||
number: 123,
|
mimeType: "application/github-pr",
|
||||||
title: "Fix race in worktree setup",
|
number: 123,
|
||||||
url: "https://github.com/getpaseo/paseo/pull/123",
|
title: "Fix race in worktree setup",
|
||||||
},
|
url: "https://github.com/getpaseo/paseo/pull/123",
|
||||||
],
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(mock.sent).toHaveLength(1);
|
expect(mock.sent).toHaveLength(1);
|
||||||
@@ -599,10 +601,12 @@ test("sends structured attachments with create_paseo_worktree_request", async ()
|
|||||||
message: {
|
message: {
|
||||||
type: "create_paseo_worktree_request";
|
type: "create_paseo_worktree_request";
|
||||||
requestId: string;
|
requestId: string;
|
||||||
attachments: Array<{ type: string; mimeType: string; number: number }>;
|
firstAgentContext: {
|
||||||
|
attachments: Array<{ type: string; mimeType: string; number: number }>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
expect(request.message.attachments).toEqual([
|
expect(request.message.firstAgentContext.attachments).toEqual([
|
||||||
{
|
{
|
||||||
type: "github_pr",
|
type: "github_pr",
|
||||||
mimeType: "application/github-pr",
|
mimeType: "application/github-pr",
|
||||||
|
|||||||
@@ -182,7 +182,6 @@ describe.skipIf(process.platform === "win32")("createWorktreeCore", () => {
|
|||||||
{
|
{
|
||||||
cwd: repoDir,
|
cwd: repoDir,
|
||||||
worktreeSlug: "legacy-rpc",
|
worktreeSlug: "legacy-rpc",
|
||||||
attachments: [],
|
|
||||||
paseoHome,
|
paseoHome,
|
||||||
runSetup: false,
|
runSetup: false,
|
||||||
},
|
},
|
||||||
@@ -199,7 +198,7 @@ describe.skipIf(process.platform === "win32")("createWorktreeCore", () => {
|
|||||||
expect(existsSync(result.worktree.worktreePath)).toBe(true);
|
expect(existsSync(result.worktree.worktreePath)).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("checks out the legacy RPC GitHub PR attachment branch", async () => {
|
test("checks out an explicit GitHub PR branch with legacy RPC fields", async () => {
|
||||||
const { tempDir, repoDir, paseoHome } = createGitHubPrRemoteRepo();
|
const { tempDir, repoDir, paseoHome } = createGitHubPrRemoteRepo();
|
||||||
cleanupPaths.push(tempDir);
|
cleanupPaths.push(tempDir);
|
||||||
|
|
||||||
@@ -207,19 +206,10 @@ describe.skipIf(process.platform === "win32")("createWorktreeCore", () => {
|
|||||||
{
|
{
|
||||||
cwd: repoDir,
|
cwd: repoDir,
|
||||||
worktreeSlug: "review-pr-123",
|
worktreeSlug: "review-pr-123",
|
||||||
|
githubPrNumber: 123,
|
||||||
|
refName: "feature/review-pr",
|
||||||
paseoHome,
|
paseoHome,
|
||||||
runSetup: false,
|
runSetup: false,
|
||||||
attachments: [
|
|
||||||
{
|
|
||||||
type: "github_pr",
|
|
||||||
mimeType: "application/github-pr",
|
|
||||||
number: 123,
|
|
||||||
title: "Review branch",
|
|
||||||
url: "https://github.com/getpaseo/paseo/pull/123",
|
|
||||||
baseRefName: "main",
|
|
||||||
headRefName: "feature/review-pr",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
createCoreDeps(),
|
createCoreDeps(),
|
||||||
);
|
);
|
||||||
@@ -240,19 +230,10 @@ describe.skipIf(process.platform === "win32")("createWorktreeCore", () => {
|
|||||||
const result = await createCoreWorktree(
|
const result = await createCoreWorktree(
|
||||||
{
|
{
|
||||||
cwd: repoDir,
|
cwd: repoDir,
|
||||||
|
githubPrNumber: 123,
|
||||||
|
refName: "feature/review-pr",
|
||||||
paseoHome,
|
paseoHome,
|
||||||
runSetup: false,
|
runSetup: false,
|
||||||
attachments: [
|
|
||||||
{
|
|
||||||
type: "github_pr",
|
|
||||||
mimeType: "application/github-pr",
|
|
||||||
number: 123,
|
|
||||||
title: "Review branch",
|
|
||||||
url: "https://github.com/getpaseo/paseo/pull/123",
|
|
||||||
baseRefName: "main",
|
|
||||||
headRefName: "feature/review-pr",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
createCoreDeps(),
|
createCoreDeps(),
|
||||||
);
|
);
|
||||||
@@ -549,19 +530,10 @@ describe.skipIf(process.platform === "win32")("createWorktreeCore", () => {
|
|||||||
const deps = createCoreDeps();
|
const deps = createCoreDeps();
|
||||||
const input = {
|
const input = {
|
||||||
cwd: repoDir,
|
cwd: repoDir,
|
||||||
|
githubPrNumber: 123,
|
||||||
|
refName: "feature/review-pr",
|
||||||
paseoHome,
|
paseoHome,
|
||||||
runSetup: false,
|
runSetup: false,
|
||||||
attachments: [
|
|
||||||
{
|
|
||||||
type: "github_pr" as const,
|
|
||||||
mimeType: "application/github-pr" as const,
|
|
||||||
number: 123,
|
|
||||||
title: "Review branch",
|
|
||||||
url: "https://github.com/getpaseo/paseo/pull/123",
|
|
||||||
baseRefName: "main",
|
|
||||||
headRefName: "feature/review-pr",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const first = await createCoreWorktree(input, deps);
|
const first = await createCoreWorktree(input, deps);
|
||||||
@@ -588,18 +560,9 @@ describe.skipIf(process.platform === "win32")("createWorktreeCore", () => {
|
|||||||
{
|
{
|
||||||
cwd: repoDir,
|
cwd: repoDir,
|
||||||
worktreeSlug: "stubbed-github",
|
worktreeSlug: "stubbed-github",
|
||||||
|
githubPrNumber: 123,
|
||||||
paseoHome,
|
paseoHome,
|
||||||
runSetup: false,
|
runSetup: false,
|
||||||
attachments: [
|
|
||||||
{
|
|
||||||
type: "github_pr",
|
|
||||||
mimeType: "application/github-pr",
|
|
||||||
number: 123,
|
|
||||||
title: "Review branch",
|
|
||||||
url: "https://github.com/getpaseo/paseo/pull/123",
|
|
||||||
baseRefName: "main",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
createCoreDeps({ github }),
|
createCoreDeps({ github }),
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user