MCPcopy Create free account
hub / github.com/cli/cli / TestClientReadBranchConfigReturnsConfiguredValues

Function TestClientReadBranchConfigReturnsConfiguredValues

git/client_test.go:536–555  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

534}
535
536func TestClientReadBranchConfigReturnsConfiguredValues(t *testing.T) {
537 // Given all supported branch configuration values set through the client
538 repo := newTestRepo(t)
539 require.NoError(t, repo.client.SetBranchConfig(t.Context(), "trunk", "remote", "upstream"))
540 require.NoError(t, repo.client.SetBranchConfig(t.Context(), "trunk", "merge", "refs/heads/trunk"))
541 require.NoError(t, repo.client.SetBranchConfig(t.Context(), "trunk", "pushremote", "origin"))
542 require.NoError(t, repo.client.SetBranchConfig(t.Context(), "trunk", MergeBaseConfig, "release"))
543
544 // When the branch configuration is read
545 branchConfig, err := repo.client.ReadBranchConfig(t.Context(), "trunk")
546
547 // Then the persisted configuration is returned
548 require.NoError(t, err)
549 assert.Equal(t, BranchConfig{
550 RemoteName: "upstream",
551 PushRemoteName: "origin",
552 MergeRef: "refs/heads/trunk",
553 MergeBase: "release",
554 }, branchConfig)
555}
556
557func TestClientReadBranchConfigPropagatesGitError(t *testing.T) {
558 // Given a client whose repository directory no longer exists

Callers

nothing calls this directly

Calls 4

newTestRepoFunction · 0.85
SetBranchConfigMethod · 0.80
EqualMethod · 0.80
ReadBranchConfigMethod · 0.65

Tested by

no test coverage detected