package radarmap

import (
	"testing"

	"apps/backend/internal/module/radar/domain"
)

func TestProductMapperKeepsLegacyAndNormalizesSlices(t *testing.T) {
	legacy := Watch(&domain.RadarWatch{ID: "legacy", Status: domain.WatchActive})
	if legacy.ContextMode != domain.WatchContextGeneric || legacy.Terms == nil || legacy.Regions == nil {
		t.Fatalf("legacy watch mapping: %#v", legacy)
	}
	o := Opportunity(&domain.Opportunity{ID: "o", ProductMatches: []*domain.ProductMatch{nil}})
	if o.ProductMatches == nil || len(o.ProductMatches) != 0 {
		t.Fatalf("nil product match must not leak: %#v", o.ProductMatches)
	}
}
