MCPcopy Index your code
hub / github.com/coder/coder / TestRefresher_BranchNoPRYet

Function TestRefresher_BranchNoPRYet

coderd/x/gitsync/gitsync_test.go:217–253  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

215}
216
217func 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
255func TestRefresher_NoProviderForOrigin(t *testing.T) {
256 t.Parallel()

Callers

nothing calls this directly

Calls 5

RefreshMethod · 0.95
RefFunction · 0.92
NewRefresherFunction · 0.92
NewMethod · 0.65
LenMethod · 0.45

Tested by

no test coverage detected