package imagegen import "testing" func TestEditRequestApply(t *testing.T) { base := EditRequest{Prompt: "make it night", Init: Image{MIME: "image/png", Data: []byte{1}}} got := base.Apply(WithEditStrength(0.7), WithEditN(2), WithEditSeed(42)) if got.Prompt != "make it night" || len(got.Init.Data) != 1 { t.Errorf("got = %+v", got) } if got.Strength == nil || *got.Strength != 0.7 { t.Errorf("Strength = %v, want 0.7", got.Strength) } if got.N != 2 { t.Errorf("N = %d, want 2", got.N) } if got.Seed == nil || *got.Seed != 42 { t.Errorf("Seed = %v, want 42", got.Seed) } // Apply must not mutate the receiver (options apply to a copy). if base.Strength != nil || base.N != 0 || base.Seed != nil { t.Errorf("base mutated: %+v", base) } }