0.2.55 - Remote config/Request fixes
This commit is contained in:
@@ -1,6 +1,14 @@
|
||||
package api
|
||||
|
||||
import "testing"
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"log/slog"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
serverlogging "github.com/ponzischeme89/memby/server/internal/logging"
|
||||
)
|
||||
|
||||
func TestRequestMatchScorePrefersTheSpecificTitle(t *testing.T) {
|
||||
if requestMatchScore("the office", "The Office") >=
|
||||
@@ -11,3 +19,21 @@ func TestRequestMatchScorePrefersTheSpecificTitle(t *testing.T) {
|
||||
t.Fatal("exact title should rank ahead of a contained match")
|
||||
}
|
||||
}
|
||||
|
||||
func TestMediaRequestLogNamesTitleAndOutcome(t *testing.T) {
|
||||
var output bytes.Buffer
|
||||
server := &Server{log: serverlogging.New(&output, slog.LevelInfo)}
|
||||
server.logMediaRequest(context.Background(), requestPayload{
|
||||
MediaType: "series", ForeignID: 123, Title: "Severance",
|
||||
}, "successful", nil)
|
||||
|
||||
line := output.String()
|
||||
for _, want := range []string{
|
||||
"media request successful", "type=series", "title=Severance",
|
||||
"foreign_id=123", "outcome=successful",
|
||||
} {
|
||||
if !strings.Contains(line, want) {
|
||||
t.Fatalf("log %q does not contain %q", line, want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user