read_files_test.go 654 B

123456789101112131415161718192021222324
  1. package read
  2. import (
  3. "testing"
  4. "github.com/stretchr/testify/assert"
  5. )
  6. const testFile = "testdata/file_example_OOG_1MG.ogg"
  7. const testTitle = "Impact Moderato"
  8. const testArtist = "Kevin MacLeod"
  9. const testAlbum = "YouTube Audio Library"
  10. const testLengthSeconds = 74
  11. func TestReadFile(t *testing.T) {
  12. result, err := ReadFile(testFile)
  13. assert.Nil(t, err)
  14. assert.Equal(t, result.title, testTitle, "title must be correct")
  15. assert.Equal(t, result.artist, testArtist, "artist must be correct")
  16. assert.Equal(t, result.album, testAlbum, "album must be correct")
  17. assert.Equal(t, result.length, testLengthSeconds, "length must be correct")
  18. }