audio_test.go 918 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package read_test
  2. import (
  3. . "github.com/onsi/ginkgo"
  4. . "github.com/onsi/gomega"
  5. "os"
  6. "path"
  7. "github.com/felamaslen/gmus-backend/pkg/read"
  8. _ "github.com/felamaslen/gmus-backend/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.File{
  16. RelativePath: read.TestSong.RelativePath,
  17. ModifiedDate: 102118,
  18. })
  19. Expect(err).To(BeNil())
  20. Expect(*result).To(Equal(read.Song{
  21. TrackNumber: 23,
  22. Title: "Impact Moderato",
  23. Artist: "Kevin MacLeod",
  24. Album: "YouTube Audio Library",
  25. Duration: 74,
  26. BasePath: basePath,
  27. RelativePath: "file_example_OOG_1MG.ogg",
  28. ModifiedDate: 102118,
  29. }))
  30. })
  31. })
  32. })