(t *testing.T)
| 324 | } |
| 325 | |
| 326 | func TestRefresher_EmptyToken(t *testing.T) { |
| 327 | t.Parallel() |
| 328 | |
| 329 | mp := &mockProvider{} |
| 330 | |
| 331 | providers := func(_ context.Context, _ string) gitprovider.Provider { return mp } |
| 332 | tokens := func(_ context.Context, _ uuid.UUID, _ string) (*string, error) { |
| 333 | return ptr.Ref(""), nil |
| 334 | } |
| 335 | |
| 336 | r := gitsync.NewRefresher(providers, tokens, slogtest.Make(t, nil), quartz.NewReal()) |
| 337 | |
| 338 | row := database.ChatDiffStatus{ |
| 339 | ChatID: uuid.New(), |
| 340 | Url: sql.NullString{String: "https://github.com/org/repo/pull/1", Valid: true}, |
| 341 | GitRemoteOrigin: "https://github.com/org/repo", |
| 342 | GitBranch: "feature", |
| 343 | } |
| 344 | |
| 345 | ownerID := uuid.New() |
| 346 | results, err := r.Refresh(context.Background(), []gitsync.RefreshRequest{ |
| 347 | {Row: row, OwnerID: ownerID}, |
| 348 | }) |
| 349 | require.NoError(t, err) |
| 350 | require.Len(t, results, 1) |
| 351 | res := results[0] |
| 352 | |
| 353 | assert.Nil(t, res.Params) |
| 354 | require.ErrorIs(t, res.Error, gitsync.ErrNoTokenAvailable) |
| 355 | } |
| 356 | |
| 357 | func TestRefresher_ProviderFetchFails(t *testing.T) { |
| 358 | t.Parallel() |
nothing calls this directly
no test coverage detected