diff --git a/internal/homesick/cli/cli_test.go b/internal/homesick/cli/cli_test.go index 9f633d1..43434ec 100644 --- a/internal/homesick/cli/cli_test.go +++ b/internal/homesick/cli/cli_test.go @@ -79,6 +79,13 @@ func (s *CLISuite) TestRun_Exec_RunsCommandInCastleRoot() { require.Empty(s.T(), s.stderr.String()) } +func (s *CLISuite) TestRun_PullAll_NoCastlesIsNoop() { + exitCode := cli.Run([]string{"pull", "--all"}, s.stdout, s.stderr) + + require.Equal(s.T(), 0, exitCode) + require.Empty(s.T(), s.stderr.String()) +} + func (s *CLISuite) TestRun_CloneSubcommandHelp() { exitCode := cli.Run([]string{"clone", "--help"}, s.stdout, s.stderr) diff --git a/internal/homesick/core/pull_test.go b/internal/homesick/core/pull_test.go index 6bc5824..87f2fd1 100644 --- a/internal/homesick/core/pull_test.go +++ b/internal/homesick/core/pull_test.go @@ -112,3 +112,18 @@ func (s *PullSuite) TestPull_MissingCastleReturnsError() { err := s.app.Pull("missing") require.Error(s.T(), err) } + +func (s *PullSuite) TestPullAll_UpdatesAllCastlesFromOrigin() { + remoteA, cloneA := s.createRemoteWithClone("alpha") + remoteB, cloneB := s.createRemoteWithClone("zeta") + s.addRemoteCommit(remoteA, "alpha") + s.addRemoteCommit(remoteB, "zeta") + + require.NoError(s.T(), s.app.PullAll()) + require.FileExists(s.T(), filepath.Join(cloneA, "home", ".zshrc")) + require.FileExists(s.T(), filepath.Join(cloneB, "home", ".zshrc")) +} + +func (s *PullSuite) TestPullAll_NoCastlesIsNoop() { + require.NoError(s.T(), s.app.PullAll()) +}