-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add check to make sure that the head and the base are different (#…
…115) Co-authored-by: Gregor Martynus <[email protected]>
- Loading branch information
Showing
2 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { Octokit as Core } from "@octokit/core"; | ||
import { createPullRequest } from "../src"; | ||
|
||
const Octokit = Core.plugin(createPullRequest); | ||
|
||
test("Base and Head equality", async () => { | ||
const octokit = new Octokit(); | ||
|
||
try { | ||
await octokit.createPullRequest({ | ||
owner: "gr2m", | ||
repo: "pull-request-test", | ||
title: "One comes, one goes", | ||
body: "because", | ||
base: "patch", | ||
head: "patch", | ||
changes: { | ||
files: { | ||
"path/to/file1.txt": "Content for file1", | ||
"path/to/file2.txt": "Content for file2", | ||
}, | ||
commit: "why", | ||
}, | ||
}); | ||
throw new Error("Should not resolve"); | ||
} catch (error) { | ||
expect((error as Error).message).toEqual( | ||
'[octokit-plugin-create-pull-request] "head" cannot be the same value as "base"' | ||
); | ||
} | ||
}); |