audio_test.go 968 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. "github.com/felamaslen/gmus-backend/pkg/types"
  10. )
  11. var _ = Describe("Reading audio files", func() {
  12. rootDir, _ := os.Getwd()
  13. basePath := path.Join(rootDir, read.TestDirectory)
  14. Context("when the file is ogg vorbis", func() {
  15. It("should get the expected info from the file", func() {
  16. result, err := read.ReadFile(basePath, &types.File{
  17. RelativePath: read.TestSong.RelativePath,
  18. ModifiedDate: 102118,
  19. })
  20. Expect(err).To(BeNil())
  21. Expect(*result).To(Equal(types.Song{
  22. TrackNumber: 23,
  23. Title: "Impact Moderato",
  24. Artist: "Kevin MacLeod",
  25. Album: "YouTube Audio Library",
  26. Duration: 74,
  27. BasePath: basePath,
  28. RelativePath: "file_example_OOG_1MG.ogg",
  29. ModifiedDate: 102118,
  30. }))
  31. })
  32. })
  33. })