audio_test.go 808 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package read_test
  2. import (
  3. . "github.com/onsi/ginkgo"
  4. . "github.com/onsi/gomega"
  5. "os"
  6. "path"
  7. "github.com/felamaslen/go-music-player/pkg/read"
  8. _ "github.com/felamaslen/go-music-player/pkg/testing"
  9. )
  10. var _ = Describe("reading audio files", func() {
  11. rootDir, _ := os.Getwd()
  12. basePath := path.Join(rootDir, read.TestDirectory)
  13. Context("when the file is ogg vorbis", func() {
  14. It("should get the expected info from the file", func() {
  15. result, err := read.ReadFile(basePath, read.TestSong.RelativePath)
  16. Expect(err).To(BeNil())
  17. Expect(*result).To(Equal(read.Song{
  18. Title: "Impact Moderato",
  19. Artist: "Kevin MacLeod",
  20. Album: "YouTube Audio Library",
  21. Duration: 74,
  22. DurationOk: true,
  23. BasePath: basePath,
  24. RelativePath: "file_example_OOG_1MG.ogg",
  25. }))
  26. })
  27. })
  28. })