func TestGetsRepoInfo(t *testing.T) { home := internal.TempHome() defer os.RemoveAll(home) repo := git.NewGithubRepo("caarlos0/zsh-pg", home) assert.Equal(t, "caarlos0/zsh-pg", repo.Name()) assert.Equal(t, home+"caarlos0-zsh-pg", repo.Folder()) }
func TestUpdatesUnexistentRepo(t *testing.T) { home := internal.TempHome() defer os.RemoveAll(home) repo := git.NewGithubRepo("doesn-not-exist-really", home) assert.Error(t, repo.Update()) internal.AssertFileCount(t, 0, home) }
func TestClonesRepo(t *testing.T) { home := internal.TempHome() defer os.RemoveAll(home) repo := git.NewGithubRepo("caarlos0/env", home) assert.NoError(t, repo.Download()) internal.AssertFileCount(t, 1, home) }
func TestCloneDoesNothingIfFolderAlreadyExists(t *testing.T) { home := internal.TempHome() defer os.RemoveAll(home) repo := git.NewGithubRepo("caarlos0/zsh-add-upstream", home) assert.NoError(t, repo.Download()) assert.NoError(t, repo.Download()) internal.AssertFileCount(t, 1, home) }
func TestBundleAndUpdate(t *testing.T) { home := internal.TempHome() defer os.RemoveAll(home) a := antibody.New([]bundle.Bundle{ bundle.New("caarlos0/zsh-pg", home), bundle.New("caarlos0/zsh-open-pr", home), }) a.Download() a.Update() internal.AssertFileCount(t, 2, home) }
func TestCustomHome(t *testing.T) { home := internal.TempHome() defer os.RemoveAll(home) assert.Equal(t, home, antibody.Home()) }