audio_test.go 582 B

1234567891011121314151617181920212223242526272829
  1. package read
  2. import (
  3. "os"
  4. "path"
  5. "testing"
  6. _ "github.com/felamaslen/go-music-player/pkg/testing"
  7. "github.com/stretchr/testify/assert"
  8. )
  9. func TestReadFile(t *testing.T) {
  10. rootDir, _ := os.Getwd()
  11. basePath := path.Join(rootDir, TestDirectory)
  12. result, err := ReadFile(basePath, TestSong.RelativePath)
  13. assert.Nil(t, err)
  14. assert.Equal(t, Song{
  15. Title: "Impact Moderato",
  16. Artist: "Kevin MacLeod",
  17. Album: "YouTube Audio Library",
  18. Duration: 74,
  19. DurationOk: true,
  20. BasePath: basePath,
  21. RelativePath: "file_example_OOG_1MG.ogg",
  22. }, *result)
  23. }