Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): read Azure DevOps pull requests from the app #7316

Closedkummerer94(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/7316/headopened View on GitHub

Showing 2 changed files with 84 additions and 1 deletion.

x
0 of 2 viewed, 2 left
50 additions and 0 deletionsapps/server/src/pullRequest/AzureDevOpsPullRequestCli.test.tsModified
View file
@@ -97,6 +97,49 @@
}),
);
​
+ it.effect("names the repository the way az does, not the way the remote does", () =>
+ Effect.gen(function* () {
+ mockedExecute.mockReturnValueOnce(Effect.succeed(output(pullRequests(1, 1))));
+ const cli = yield* AzureDevOpsPullRequestCli.AzureDevOpsPullRequestCli;
+​
+ yield* cli.listPullRequests({
+ cwd: "/w",
+ // What the service calls a repository below an Azure host: the whole remote path.
+ repository: "acme/platform/_git/web",
+ state: "open",
+ involvement: "all",
+ viewer: "bilal@acme.dev",
+ limit: 10,
+ });
+​
+ // az puts `--repository` straight into the REST route it builds, so the path would address
+ // a route that does not exist and Azure would answer 404 rather than an empty listing.
+ const args = argsOfCall(0);
+ assert.strictEqual(args[args.indexOf("--repository") + 1], "web");
+ expect(args).not.toContain("acme/platform/_git/web");
+ }),
+ );
+​
+ it.effect("unescapes the repository name, which the remote path carries escaped", () =>
+ Effect.gen(function* () {
+ mockedExecute.mockReturnValueOnce(Effect.succeed(output(pullRequests(1, 1))));