(t *testing.T)
| 215 | } |
| 216 | |
| 217 | func TestRefresher_BranchNoPRYet(t *testing.T) { |
| 218 | t.Parallel() |
| 219 | |
| 220 | mp := &mockProvider{ |
| 221 | parseRepositoryOrigin: func(_ string) (string, string, string, bool) { |
| 222 | return "org", "repo", "https://github.com/org/repo", true |
| 223 | }, |
| 224 | resolveBranchPR: func(_ context.Context, _ string, _ gitprovider.BranchRef) (*gitprovider.PRRef, error) { |
| 225 | return nil, nil |
| 226 | }, |
| 227 | } |
| 228 | |
| 229 | providers := func(_ context.Context, _ string) gitprovider.Provider { return mp } |
| 230 | tokens := func(_ context.Context, _ uuid.UUID, _ string) (*string, error) { |
| 231 | return ptr.Ref("test-token"), nil |
| 232 | } |
| 233 | |
| 234 | r := gitsync.NewRefresher(providers, tokens, slogtest.Make(t, nil), quartz.NewReal()) |
| 235 | |
| 236 | row := database.ChatDiffStatus{ |
| 237 | ChatID: uuid.New(), |
| 238 | Url: sql.NullString{}, |
| 239 | GitRemoteOrigin: "https://github.com/org/repo", |
| 240 | GitBranch: "feature", |
| 241 | } |
| 242 | |
| 243 | ownerID := uuid.New() |
| 244 | results, err := r.Refresh(context.Background(), []gitsync.RefreshRequest{ |
| 245 | {Row: row, OwnerID: ownerID}, |
| 246 | }) |
| 247 | require.NoError(t, err) |
| 248 | require.Len(t, results, 1) |
| 249 | res := results[0] |
| 250 | |
| 251 | assert.NoError(t, res.Error) |
| 252 | assert.Nil(t, res.Params) |
| 253 | } |
| 254 | |
| 255 | func TestRefresher_NoProviderForOrigin(t *testing.T) { |
| 256 | t.Parallel() |
nothing calls this directly
no test coverage detected