Skip to content

🎧 Your Personal Streaming Service

test: removed unused `file` property

Deluan28bad95e66f3
diff --git a/.dockerignore b/.dockerignore
index fdc0bd0df..6d4360ee3 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -6,7 +6,6 @@ Dockerfile
data
*.db
testDB
-*_test.go
navidrome
navidrome.db
navidrome.toml
diff --git a/engine/media_streamer_test.go b/engine/media_streamer_test.go
index cbf0445bf..329c69408 100644
--- a/engine/media_streamer_test.go
+++ b/engine/media_streamer_test.go
@@ -1,7 +1,6 @@
package engine
import (
- "os"
"time"
"github.com/deluan/navidrome/conf"
@@ -50,11 +49,7 @@ var _ = Describe("MediaStreamer", func() {
BeforeEach(func() {
modTime = time.Now()
mf := &model.MediaFile{ID: "123", Path: "test.mp3", UpdatedAt: modTime, Suffix: "mp3"}
- file, err := os.Open("tests/fixtures/test.mp3")
- if err != nil {
- panic(err)
- }
- rawStream = &rawMediaStream{mf: mf, file: file, ctx: ctx}
+ rawStream = &rawMediaStream{mf: mf, ctx: ctx}
})
It("returns the ContentType", func() {
diff --git a/tests/matchers.go b/tests/matchers.go
deleted file mode 100644
index c5d6fc265..000000000
--- a/tests/matchers.go
+++ /dev/null
@@ -1,68 +0,0 @@
-package tests
-
-import (
- "bytes"
- "crypto/md5"
- "encoding/json"
- "encoding/xml"
- "fmt"
-
- "github.com/deluan/navidrome/server/subsonic/responses"
- "github.com/smartystreets/goconvey/convey"
-)
-
-func ShouldMatchXML(actual interface{}, expected ...interface{}) string {
- xml, err := xml.Marshal(actual)
- if err != nil {
- return fmt.Sprintf("Malformed XML: %v", err)
- }
- return convey.ShouldEqual(string(xml), expected[0].(string))
-
-}
-
-func ShouldMatchJSON(actual interface{}, expected ...interface{}) string {
- json, err := json.Marshal(actual)
- if err != nil {
- return fmt.Sprintf("Malformed JSON: %v", err)
- }
- s := UnindentJSON(json)
- return convey.ShouldEqual(s, expected[0].(string))
-}
-
-func ShouldContainJSON(actual interface{}, expected ...interface{}) string {
- a := UnindentJSON(actual.(*bytes.Buffer).Bytes())
-
- return convey.ShouldContainSubstring(a, expected[0].(string))
-}
-
-func ShouldReceiveError(actual interface{}, expected ...interface{}) string {
- v := responses.Subsonic{}
- err := xml.Unmarshal(actual.(*bytes.Buffer).Bytes(), &v)
- if err != nil {
- return fmt.Sprintf("Malformed XML: %v", err)
- }
-
- return convey.ShouldEqual(v.Error.Code, expected[0].(int))
-}
-
-func ShouldMatchMD5(actual interface{}, expected ...interface{}) string {
- a := fmt.Sprintf("%x", md5.Sum(actual.([]byte)))
- return convey.ShouldEqual(a, expected[0].(string))
-}
-
-func ShouldBeAValid(actual interface{}, expected ...interface{}) string {
- v := responses.Subsonic{}
- err := json.Unmarshal(actual.(*bytes.Buffer).Bytes(), &v)
- if err != nil {
- return fmt.Sprintf("Malformed response: %v", err)
- }
-
- return ""
-}
-
-func UnindentJSON(j []byte) string {
- var m = make(map[string]interface{})
- json.Unmarshal(j, &m)
- s, _ := json.Marshal(m)
- return string(s)
-}