itests

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 6, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TestUserEmail = "test@test.com"
	TestUserName  = "Test User"
	TestRepoOrg   = "testorg"
	TestRepoName  = "testrepo"
)

Constants for testing

Variables

This section is empty.

Functions

func AssertBranchExists

func AssertBranchExists(t *testing.T, env *TestEnv, name string)

AssertBranchExists asserts that a branch exists in the stack

func AssertBranchNotExists

func AssertBranchNotExists(t *testing.T, env *TestEnv, name string)

AssertBranchNotExists asserts that a branch does not exist in the stack

func AssertBranchParent

func AssertBranchParent(t *testing.T, env *TestEnv, name, expectedParent string)

AssertBranchParent asserts that a branch has the expected parent

func AssertCommitsAhead

func AssertCommitsAhead(t *testing.T, env *TestEnv, branch, base string, expected int)

AssertCommitsAhead asserts the number of commits ahead

func CreateBranch

func CreateBranch(t *testing.T, env *TestEnv, name, parent string)

CreateBranch creates a branch using the stack manager

func CreateBranchWithCommit

func CreateBranchWithCommit(t *testing.T, env *TestEnv, name, parent string)

CreateBranchWithCommit creates a branch and adds a commit to it

func GitCommit

func GitCommit(t *testing.T, dir, filename, content, message string)

GitCommit creates a commit in the specified directory

func GitCommitMultiple

func GitCommitMultiple(t *testing.T, dir string, count int, prefix string)

GitCommitMultiple creates multiple commits in the specified directory

func NewGit

func NewGit(env *TestEnv) *git.Git

NewGit creates a new git instance for the repo

func NewGitInWorktree

func NewGitInWorktree(env *TestEnv, branchName string) *git.Git

NewGitInWorktree creates a new git instance for a worktree

func RunGhCommand

func RunGhCommand(t *testing.T, env *TestEnv, args ...string) (string, error)

RunGhCommand runs a gh command using the stub

Types

type TestEnv

type TestEnv struct {
	TmpDir       string
	RepoDir      string
	WorktreeDir  string
	ConfigDir    string
	StubBinDir   string
	OriginalHome string
	OriginalPath string
}

TestEnv holds the test environment configuration

func SetupTestEnv

func SetupTestEnv(t *testing.T) *TestEnv

SetupTestEnv creates a complete test environment with git repo, config, and stub gh

func (*TestEnv) Cleanup

func (env *TestEnv) Cleanup()

Cleanup cleans up the test environment

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL