package core_test import ( "bytes" "io" "os" "path/filepath" "testing" "git.hrafn.xyz/aether/gosick/internal/homesick/core" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" ) type ShowPathSuite struct { suite.Suite tmpDir string homeDir string reposDir string stdout *bytes.Buffer app *core.App } func TestShowPathSuite(t *testing.T) { suite.Run(t, new(ShowPathSuite)) } func (s *ShowPathSuite) SetupTest() { s.tmpDir = s.T().TempDir() s.homeDir = filepath.Join(s.tmpDir, "home") s.reposDir = filepath.Join(s.homeDir, ".homesick", "repos") require.NoError(s.T(), os.MkdirAll(s.reposDir, 0o755)) s.stdout = &bytes.Buffer{} s.app = &core.App{ HomeDir: s.homeDir, ReposDir: s.reposDir, Stdout: s.stdout, Stderr: io.Discard, } } func (s *ShowPathSuite) TestShowPath_OutputsCastlePath() { require.NoError(s.T(), s.app.ShowPath("castle_repo")) require.Equal( s.T(), filepath.Join(s.reposDir, "castle_repo")+"\n", s.stdout.String(), ) }