From f92faf9a0205f4bf0b68b673266517fa8882eaa5 Mon Sep 17 00:00:00 2001 From: 0ko <0ko@noreply.codeberg.org> Date: Sun, 30 Mar 2025 15:43:13 +0500 Subject: [PATCH] add testdata for e2e --- tests/e2e/declare_repos_test.go | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/tests/e2e/declare_repos_test.go b/tests/e2e/declare_repos_test.go index f701b11f97..169a3b7538 100644 --- a/tests/e2e/declare_repos_test.go +++ b/tests/e2e/declare_repos_test.go @@ -26,6 +26,8 @@ type FileChanges struct { Filename string CommitMsg string Versions []string + OldBranch string + NewBranch string } // put your Git repo declarations in here @@ -48,6 +50,19 @@ func DeclareGitRepos(t *testing.T) func() { CommitMsg: "Another commit which mentions @user1 in the title\nand @user2 in the text", }, }), + newRepo(t, 2, "pr-def-merge-style-merge", []FileChanges{ + { + Filename: "readme.md", + Versions: []string{""}, + CommitMsg: "Initial commit", + }, + { + Filename: "license.md", + Versions: []string{""}, + CommitMsg: "Add license", + NewBranch: "add-license", + }, + }), // add your repo declarations here } @@ -78,6 +93,16 @@ func newRepo(t *testing.T, userID int64, repoName string, fileChanges []FileChan commitMsg = fmt.Sprintf("Patch: %s-%d", file.Filename, i+1) } + // default to branch `main` + oldBranch := file.OldBranch + if oldBranch == "" { + oldBranch = "main" + } + newBranch := file.NewBranch + if newBranch == "" { + newBranch = "main" + } + resp, err := files_service.ChangeRepoFiles(git.DefaultContext, somerepo, user, &files_service.ChangeRepoFilesOptions{ Files: []*files_service.ChangeRepoFile{{ Operation: operation, @@ -85,8 +110,8 @@ func newRepo(t *testing.T, userID int64, repoName string, fileChanges []FileChan ContentReader: strings.NewReader(version), }}, Message: commitMsg, - OldBranch: "main", - NewBranch: "main", + OldBranch: oldBranch, + NewBranch: newBranch, Author: &files_service.IdentityOptions{ Name: user.Name, Email: user.Email,