mirror of
https://github.com/navidrome/navidrome.git
synced 2026-11-25 19:39:46 +01:00
add migration, more tests
This commit is contained in:
parent
6e6f7304ed
commit
40d29f2cb1
8 changed files with 261 additions and 16 deletions
|
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
"status": "ok",
|
||||
"version": "1.8.0",
|
||||
"type": "navidrome",
|
||||
"serverVersion": "v0.0.0",
|
||||
"openSubsonic": true,
|
||||
"lyricsList": {
|
||||
"structuredLyrics": [
|
||||
{
|
||||
"lang": "eng",
|
||||
"line": [
|
||||
{
|
||||
"start": 18800,
|
||||
"value": "We're no strangers to love"
|
||||
},
|
||||
{
|
||||
"start": 22801,
|
||||
"value": "You know the rules and so do I"
|
||||
}
|
||||
],
|
||||
"synced": true
|
||||
},
|
||||
{
|
||||
"lang": "xxx",
|
||||
"line": [
|
||||
{
|
||||
"value": "We're no strangers to love"
|
||||
},
|
||||
{
|
||||
"value": "You know the rules and so do I"
|
||||
}
|
||||
],
|
||||
"synced": false
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.8.0" type="navidrome" serverVersion="v0.0.0" openSubsonic="true">
|
||||
<lyricsList>
|
||||
<structuredLyrics lang="eng" synced="true">
|
||||
<line start="18800">
|
||||
<value>We're no strangers to love</value>
|
||||
</line>
|
||||
<line start="22801">
|
||||
<value>You know the rules and so do I</value>
|
||||
</line>
|
||||
</structuredLyrics>
|
||||
<structuredLyrics lang="xxx" synced="false">
|
||||
<line>
|
||||
<value>We're no strangers to love</value>
|
||||
</line>
|
||||
<line>
|
||||
<value>You know the rules and so do I</value>
|
||||
</line>
|
||||
</structuredLyrics>
|
||||
</lyricsList>
|
||||
</subsonic-response>
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"status": "ok",
|
||||
"version": "1.8.0",
|
||||
"type": "navidrome",
|
||||
"serverVersion": "v0.0.0",
|
||||
"openSubsonic": true,
|
||||
"lyricsList": {}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
<subsonic-response xmlns="http://subsonic.org/restapi" status="ok" version="1.8.0" type="navidrome" serverVersion="v0.0.0" openSubsonic="true">
|
||||
<lyricsList></lyricsList>
|
||||
</subsonic-response>
|
||||
|
|
@ -11,6 +11,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/navidrome/navidrome/consts"
|
||||
"github.com/navidrome/navidrome/model"
|
||||
. "github.com/navidrome/navidrome/server/subsonic/responses"
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
. "github.com/onsi/gomega"
|
||||
|
|
@ -795,4 +796,62 @@ var _ = Describe("Responses", func() {
|
|||
})
|
||||
})
|
||||
})
|
||||
|
||||
Describe("getLyricsBySongId", func() {
|
||||
BeforeEach(func() {
|
||||
response.LyricsList = &LyricsList{}
|
||||
})
|
||||
|
||||
Describe("without data", func() {
|
||||
It("should match .XML", func() {
|
||||
Expect(xml.MarshalIndent(response, "", " ")).To(MatchSnapshot())
|
||||
})
|
||||
It("should match .JSON", func() {
|
||||
Expect(json.MarshalIndent(response, "", " ")).To(MatchSnapshot())
|
||||
})
|
||||
})
|
||||
|
||||
Describe("with data", func() {
|
||||
BeforeEach(func() {
|
||||
times := []int64{int64(18800), int64(22801)}
|
||||
|
||||
response.LyricsList.StructuredLyrics = model.Lyrics{
|
||||
{
|
||||
Lang: "eng",
|
||||
Synced: true,
|
||||
Line: []model.Line{
|
||||
{
|
||||
Start: ×[0],
|
||||
Value: "We're no strangers to love",
|
||||
},
|
||||
{
|
||||
Start: ×[1],
|
||||
Value: "You know the rules and so do I",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Lang: "xxx",
|
||||
Synced: false,
|
||||
Line: []model.Line{
|
||||
{
|
||||
Value: "We're no strangers to love",
|
||||
},
|
||||
{
|
||||
Value: "You know the rules and so do I",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
It("should match .XML", func() {
|
||||
Expect(xml.MarshalIndent(response, "", " ")).To(MatchSnapshot())
|
||||
})
|
||||
It("should match .JSON", func() {
|
||||
Expect(json.MarshalIndent(response, "", " ")).To(MatchSnapshot())
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue