package videogen import "testing" func TestApplyDoesNotMutateOriginal(t *testing.T) { orig := Request{Prompt: "a cat"} got := orig.Apply( WithSize("1280x704"), WithNumFrames(81), WithFPS(16), WithSteps(4), WithGuidanceScale(1.0), WithNegativePrompt("blurry"), WithSeed(42), WithInitImage(Image{MIME: "image/png", Data: []byte{1}}), ) if orig.Size != "" || orig.NumFrames != 0 || orig.FPS != 0 || orig.Steps != nil || orig.GuidanceScale != nil || orig.NegativePrompt != "" || orig.Seed != nil || orig.InitImage != nil { t.Fatalf("original mutated: %+v", orig) } if got.Size != "1280x704" || got.NumFrames != 81 || got.FPS != 16 { t.Errorf("size/frames/fps = %q/%d/%d", got.Size, got.NumFrames, got.FPS) } if got.Steps == nil || *got.Steps != 4 { t.Errorf("steps = %v", got.Steps) } if got.GuidanceScale == nil || *got.GuidanceScale != 1.0 { t.Errorf("guidance = %v", got.GuidanceScale) } if got.NegativePrompt != "blurry" { t.Errorf("negative = %q", got.NegativePrompt) } if got.Seed == nil || *got.Seed != 42 { t.Errorf("seed = %v", got.Seed) } if got.InitImage == nil || got.InitImage.MIME != "image/png" { t.Errorf("init image = %+v", got.InitImage) } } func TestApplyModelOptions(t *testing.T) { called := false ApplyModelOptions([]ModelOption{func(*ModelConfig) { called = true }}) if !called { t.Fatal("model option not applied") } }