func TestSourceablesDotSh(t *testing.T) { home := internal.TempHome() defer os.RemoveAll(home) b := bundle.New("rupa/z", home) b.Download() assert.Len(t, b.Sourceables(), 1) }
func TestSourceablesZshTheme(t *testing.T) { home := internal.TempHome() defer os.RemoveAll(home) b := bundle.New("caiogondim/bullet-train-oh-my-zsh-theme", home) b.Download() assert.Len(t, b.Sourceables(), 1) }
func TestBundleSourceables(t *testing.T) { home := internal.TempHome() defer os.RemoveAll(home) b := bundle.New("caarlos0/zsh-pg", home) b.Download() assert.NotEmpty(t, b.Sourceables()) }
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()) }
func TestParseWithEmptyLines(t *testing.T) { home := internal.TempHome() defer os.RemoveAll(home) s := "caarlos0/zsh-pg\n\n \ncaarlos0/zsh-open-pr" assert.Len(t, bundle.Parse(s, home), 2) }
func TestList(t *testing.T) { home := internal.TempHome() defer os.RemoveAll(home) bundle.New("caarlos0/zsh-pg", home).Download() assert.NotEmpty(t, bundle.List(home)) }
func TestListEmptyFolder(t *testing.T) { home := internal.TempHome() defer os.RemoveAll(home) assert.Empty(t, bundle.List(home)) }