fix(jellycompat): include Wholphin display preference dimensions (#102)
This commit is contained in:
@@ -14,16 +14,18 @@ import (
|
||||
|
||||
// displayPreferencesDTO mirrors Jellyfin's DisplayPreferences response.
|
||||
type displayPreferencesDTO struct {
|
||||
ID string `json:"Id"`
|
||||
SortBy string `json:"SortBy"`
|
||||
SortOrder string `json:"SortOrder"`
|
||||
RememberIndexing bool `json:"RememberIndexing"`
|
||||
RememberSorting bool `json:"RememberSorting"`
|
||||
ScrollDirection string `json:"ScrollDirection"`
|
||||
ShowBackdrop bool `json:"ShowBackdrop"`
|
||||
ShowSidebar bool `json:"ShowSidebar"`
|
||||
Client string `json:"Client"`
|
||||
CustomPrefs map[string]string `json:"CustomPrefs"`
|
||||
ID string `json:"Id"`
|
||||
SortBy string `json:"SortBy"`
|
||||
SortOrder string `json:"SortOrder"`
|
||||
RememberIndexing bool `json:"RememberIndexing"`
|
||||
RememberSorting bool `json:"RememberSorting"`
|
||||
ScrollDirection string `json:"ScrollDirection"`
|
||||
ShowBackdrop bool `json:"ShowBackdrop"`
|
||||
ShowSidebar bool `json:"ShowSidebar"`
|
||||
PrimaryImageHeight int `json:"PrimaryImageHeight"`
|
||||
PrimaryImageWidth int `json:"PrimaryImageWidth"`
|
||||
Client string `json:"Client"`
|
||||
CustomPrefs map[string]string `json:"CustomPrefs"`
|
||||
}
|
||||
|
||||
// DisplayPreferencesHandler serves Jellyfin display preferences endpoints,
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package jellycompat
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestDefaultDisplayPreferencesIncludesRequiredImageDimensions(t *testing.T) {
|
||||
dto := defaultDisplayPreferences("default", "Wholphin")
|
||||
|
||||
body, err := json.Marshal(dto)
|
||||
if err != nil {
|
||||
t.Fatalf("marshal default display preferences: %v", err)
|
||||
}
|
||||
|
||||
var raw map[string]any
|
||||
if err := json.Unmarshal(body, &raw); err != nil {
|
||||
t.Fatalf("unmarshal default display preferences: %v", err)
|
||||
}
|
||||
|
||||
if _, ok := raw["PrimaryImageHeight"]; !ok {
|
||||
t.Fatal("PrimaryImageHeight missing from display preferences JSON")
|
||||
}
|
||||
if _, ok := raw["PrimaryImageWidth"]; !ok {
|
||||
t.Fatal("PrimaryImageWidth missing from display preferences JSON")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user