(t *testing.T)
| 101 | } |
| 102 | |
| 103 | func TestRunDeployCommand_RoutesToOrgRunner(t *testing.T) { |
| 104 | cmd := NewDeployCommand(func(string) error { return nil }) |
| 105 | require.NotNil(t, cmd) |
| 106 | require.NoError(t, cmd.Flags().Set("org", "octo")) |
| 107 | require.NoError(t, cmd.Flags().Set("repos", "api-*")) |
| 108 | require.NoError(t, cmd.Flags().Set("yes", "true")) |
| 109 | require.NoError(t, cmd.Flags().Set("cool-down", "24h")) |
| 110 | |
| 111 | origRunDeployForOrg := runDeployForOrgFn |
| 112 | origRunDeploy := runDeployFn |
| 113 | defer func() { |
| 114 | runDeployForOrgFn = origRunDeployForOrg |
| 115 | runDeployFn = origRunDeploy |
| 116 | }() |
| 117 | |
| 118 | calledOrg := false |
| 119 | runDeployForOrgFn = func(ctx context.Context, org string, repoGlobs []string, workflows []string, addOpts AddOptions, coolDown time.Duration, yes bool, verbose bool) error { |
| 120 | calledOrg = true |
| 121 | assert.Equal(t, "octo", org) |
| 122 | assert.Equal(t, []string{"api-*"}, repoGlobs) |
| 123 | assert.Equal(t, []string{"githubnext/agentics/ci-doctor"}, workflows) |
| 124 | assert.True(t, yes) |
| 125 | assert.Equal(t, 24*time.Hour, coolDown) |
| 126 | return nil |
| 127 | } |
| 128 | runDeployFn = func(context.Context, string, []string, AddOptions, time.Duration) error { |
| 129 | t.Fatalf("single-repo deploy runner should not be called in --org mode") |
| 130 | return nil |
| 131 | } |
| 132 | |
| 133 | err := runDeployCommand(cmd, []string{"githubnext/agentics/ci-doctor"}, func(string) error { return nil }) |
| 134 | require.NoError(t, err) |
| 135 | assert.True(t, calledOrg) |
| 136 | } |
| 137 | |
| 138 | func TestBuildDeployPRMetadata_SingleWorkflow(t *testing.T) { |
| 139 | title, body := buildDeployPRMetadata([]string{"githubnext/agentics/ci-doctor"}, "owner/repo") |
nothing calls this directly
no test coverage detected