Add branchless trail creation · Entire

Add branchless trail creation

30fc3db→main·

dipree·3w ago·2 files·+202 added/-10 removed

Sessions

6604ab821878View transcript

Changes

2

875 unmodified lines
// Code for running trail creation
var runTrailCreateForm = func(form *huh.Form) error { return form.Run() }

func runTrailCreateInteractive(title, body, branch, statusStr *string, noBranch bool) error {

...
}
func TestPrepareTrailCreateBranchSkipsBranchlessTrail(t *testing.T) {
  ...
}

Testing Functions

TestValidateTrailCreateFlagCombosRejectsBranchlessConflicts

t.Run("branch", func(t *testing.T) {
    cmd := newTrailCreateCmd()
    require.NoError(t, cmd.Flags().Set("branch", "feature/x"))
    err := validateTrailCreateFlagCombos(cmd, false, true)
    require.EqualError(t, err, "cannot combine --no-branch with --branch")
})

Functions to Validate Trails

func TestValidateTrailCreateFieldsAllowsBranchlessEmptyBranch(t *testing.T) {
    require.NoError(t, validateTrailCreateFields(context.Background(), "Branchless", "", string(trail.StatusOpen), true))
}

Run Trail Create Commands

t.Run("checkout", func(t *testing.T) {
    cmd := newTrailCreateCmd()
    err := validateTrailCreateFlagCombos(cmd, true, true)
    require.EqualError(t, err, "cannot combine --no-branch with --checkout")
})

Other Functions

func TestRunTrailCreateBranchlessHappyPath(t *testing.T) {
    // Setting up server and environment for testing
}

This cleaned content preserves the main elements of the original while removing non-essential information such as navigation and headers.