34 lines
999 B
Go
34 lines
999 B
Go
package vidmod
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
"go.mongodb.org/mongo-driver/bson"
|
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
|
)
|
|
|
|
func TestPendingH265SuccessFilterBindsAttemptState(t *testing.T) {
|
|
id := primitive.NewObjectID()
|
|
source := " /sp/movie/index.m3u8 "
|
|
pendingAt := time.Date(2026, 7, 25, 12, 30, 0, 0, time.UTC)
|
|
filter := pendingH265AttemptFilter(id, source, pendingAt)
|
|
|
|
if filter["_id"] != id {
|
|
t.Fatalf("filter id = %v, want %v", filter["_id"], id)
|
|
}
|
|
if filter["sourceURL"] != source {
|
|
t.Fatalf("filter sourceURL = %q, want exact stored source %q", filter["sourceURL"], source)
|
|
}
|
|
if filter["h265Status"] != H265StatusPending {
|
|
t.Fatalf("filter status = %v, want pending", filter["h265Status"])
|
|
}
|
|
if filter["h265PendingAt"] != pendingAt {
|
|
t.Fatalf("filter pendingAt = %v, want %v", filter["h265PendingAt"], pendingAt)
|
|
}
|
|
missing, ok := filter["$or"].(bson.A)
|
|
if !ok || len(missing) != 3 {
|
|
t.Fatalf("filter must require a missing H265 URL: %#v", filter["$or"])
|
|
}
|
|
}
|