mirror of https://gitlab.com/gitlab-org/cli.git
Inverting test logic and fixing extra --global
This commit is contained in:
parent
d82c90021d
commit
3214a631f6
|
@ -47,7 +47,7 @@ func initGitRepoWithCommit(t *testing.T) {
|
|||
|
||||
func configureGitConfig(t *testing.T) {
|
||||
// CI will throw errors using a git command without a configuration
|
||||
nameConfig := GitCommand("config", "--global", "user.name", "glab test bot")
|
||||
nameConfig := GitCommand("config", "user.name", "glab test bot")
|
||||
_, err := run.PrepareCmd(nameConfig).Output()
|
||||
require.NoError(t, err)
|
||||
|
||||
|
@ -543,7 +543,16 @@ func TestListTags(t *testing.T) {
|
|||
|
||||
for name, tt := range cases {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
if !tt.wantErr {
|
||||
if tt.wantErr {
|
||||
tempDir := t.TempDir()
|
||||
// move to a directory without a .git subdirectory
|
||||
err := os.Chdir(tempDir)
|
||||
require.NoError(t, err)
|
||||
|
||||
tags, err := ListTags()
|
||||
require.Equal(t, tt.errString, errors.Unwrap(err).Error())
|
||||
require.Equal(t, tt.expected, tags)
|
||||
} else {
|
||||
initGitRepoWithCommit(t)
|
||||
|
||||
for tag := range tt.expected {
|
||||
|
@ -554,15 +563,6 @@ func TestListTags(t *testing.T) {
|
|||
tags, err := ListTags()
|
||||
require.Equal(t, tt.expected, tags)
|
||||
require.NoError(t, err)
|
||||
} else {
|
||||
tempDir := t.TempDir()
|
||||
// move to a directory without a .git subdirectory
|
||||
err := os.Chdir(tempDir)
|
||||
require.NoError(t, err)
|
||||
|
||||
tags, err := ListTags()
|
||||
require.Equal(t, tt.errString, errors.Unwrap(err).Error())
|
||||
require.Equal(t, tt.expected, tags)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue