Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): GitLab merge requests can expand unchanged lines #17528

MergedScottN-PV(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/17528/headmerged by Yash-Singh1(GitHub profile, opens in a new tab) View on GitHub

Showing 2 changed files with 69 additions and 0 deletions.

x
0 of 2 viewed, 2 left
66 additions and 0 deletionspackages/source-control-gitlab/src/server/GitLabPullRequestProvider.test.tsModified
View file
@@ -212,3 +212,69 @@
}),
});
+​
+describe("expanding unchanged lines", () => {
+ const change = {
+ cwd: "/w",
+ repository: "acme/web",
+ host: "gitlab.com",
+ number: 7,
+ changeType: "change" as const,
+ oldPath: "src/page.ts",
+ newPath: "src/page.ts",
+ };
+​
+ it.effect("reads both sides of a file through the merge request or one of its commits", () =>
+ Effect.gen(function* () {
+ const getMergeRequestDiffFileContents = vi.fn(() =>
+ Effect.succeed({ oldContents: "before\n", newContents: "after\n" }),
+ );
+ const provider = yield* make.pipe(
+ Effect.provide(
+ Layer.mock(GitLabPullRequestCli.GitLabPullRequestCli)({
+ getMergeRequestDiffFileContents,
+ }),
+ ),
+ );
+ assert.isDefined(provider.getDiffFileContents);
+ const oneCommit = { ...change, commit: "a1b2c3d" };