mirror of
https://github.com/kiegroup/git-backporting.git
synced 2025-06-27 21:23:48 +00:00
fix: --no-squash on single-commit GitLab MR (#93)
Due to off-by-one error in GitLabMapper, --no-squash was not effective on an MR containing single commit. Fix by using the same condition as GitHubMapper.
This commit is contained in:
parent
b7df1f80dc
commit
300fa91a8a
7 changed files with 376 additions and 165 deletions
|
@ -1,7 +1,7 @@
|
|||
import LoggerServiceFactory from "@bp/service/logger/logger-service-factory";
|
||||
import { Moctokit } from "@kie/mock-github";
|
||||
import { TARGET_OWNER, REPO, MERGED_PR_FIXTURE, OPEN_PR_FIXTURE, NOT_MERGED_PR_FIXTURE, NOT_FOUND_PR_NUMBER, MULT_COMMITS_PR_FIXTURE, MULT_COMMITS_PR_COMMITS, NEW_PR_URL, NEW_PR_NUMBER } from "./github-data";
|
||||
import { CLOSED_NOT_MERGED_MR, MERGED_SQUASHED_MR, NESTED_NAMESPACE_MR, OPEN_MR, OPEN_PR_COMMITS, PROJECT_EXAMPLE, NESTED_PROJECT_EXAMPLE, SUPERUSER} from "./gitlab-data";
|
||||
import { CLOSED_NOT_MERGED_MR, MERGED_SQUASHED_MR, NESTED_NAMESPACE_MR, OPEN_MR, OPEN_PR_COMMITS, PROJECT_EXAMPLE, NESTED_PROJECT_EXAMPLE, SUPERUSER, MERGED_SQUASHED_MR_COMMITS } from "./gitlab-data";
|
||||
|
||||
// high number, for each test we are not expecting
|
||||
// to send more than 3 reqs per api endpoint
|
||||
|
@ -30,6 +30,8 @@ export const getAxiosMocked = (url: string) => {
|
|||
data = NESTED_PROJECT_EXAMPLE;
|
||||
} else if (url.endsWith("users?username=superuser")) {
|
||||
data = [SUPERUSER];
|
||||
} else if (url.endsWith("merge_requests/1/commits")) {
|
||||
data = MERGED_SQUASHED_MR_COMMITS;
|
||||
} else if (url.endsWith("merge_requests/2/commits")) {
|
||||
data = OPEN_PR_COMMITS;
|
||||
}
|
||||
|
|
|
@ -689,6 +689,29 @@ export const CLOSED_NOT_MERGED_MR = {
|
|||
}
|
||||
};
|
||||
|
||||
export const MERGED_SQUASHED_MR_COMMITS = [
|
||||
{
|
||||
"id":"e4dd336a4a20f394df6665994df382fb1d193a11",
|
||||
"short_id":"e4dd336a",
|
||||
"created_at":"2023-06-29T09:59:10.000Z",
|
||||
"parent_ids":[
|
||||
|
||||
],
|
||||
"title":"Add new file",
|
||||
"message":"Add new file",
|
||||
"author_name":"Super User",
|
||||
"author_email":"superuser@email.com",
|
||||
"authored_date":"2023-06-29T09:59:10.000Z",
|
||||
"committer_name":"Super User",
|
||||
"committer_email":"superuser@email.com",
|
||||
"committed_date":"2023-06-29T09:59:10.000Z",
|
||||
"trailers":{
|
||||
|
||||
},
|
||||
"web_url":"https://gitlab.com/superuser/backporting-example/-/commit/e4dd336a4a20f394df6665994df382fb1d193a11"
|
||||
},
|
||||
];
|
||||
|
||||
export const OPEN_PR_COMMITS = [
|
||||
{
|
||||
"id":"974519f65c9e0ed65277cd71026657a09fca05e7",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue