28 lines
624 B
Go
28 lines
624 B
Go
package vidser
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"go.mongodb.org/mongo-driver/bson"
|
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
|
)
|
|
|
|
func TestApplyScheduledVideoModuleID(t *testing.T) {
|
|
moduleID := primitive.NewObjectID()
|
|
update := bson.M{}
|
|
|
|
applyScheduledVideoModuleID(update, moduleID)
|
|
|
|
if got := update["mId"]; got != moduleID.Hex() {
|
|
t.Fatalf("mId = %v, want %s", got, moduleID.Hex())
|
|
}
|
|
}
|
|
|
|
func TestApplyScheduledVideoModuleIDIgnoresEmptyID(t *testing.T) {
|
|
update := bson.M{}
|
|
applyScheduledVideoModuleID(update, primitive.NilObjectID)
|
|
if _, ok := update["mId"]; ok {
|
|
t.Fatal("empty module id must not be written")
|
|
}
|
|
}
|