package netbox import ( "testing" ) func TestCustomFieldSpec(t *testing.T) { spec := customFieldSpec("hw_id") if spec == nil { t.Fatal("hw_id spec not found") } if spec.Type != "text" { t.Errorf("hw_id type: want text, got %s", spec.Type) } for _, ot := range spec.ObjectTypes { if ot == "dcim.device" { return } } t.Error("hw_id ObjectTypes must include dcim.device") } func TestCustomFieldSpecCatalogStatus(t *testing.T) { spec := customFieldSpec("catalog_status") if spec == nil { t.Fatal("catalog_status spec not found") } if spec.Type != "text" { t.Errorf("catalog_status type: want text (not selection), got %s", spec.Type) } } func TestCustomFieldSpecPhotoURLs(t *testing.T) { spec := customFieldSpec("photo_urls") if spec == nil { t.Fatal("photo_urls spec not found") } if spec.Description == "" { t.Error("photo_urls must have a description") } } func TestAllEightFieldsDefined(t *testing.T) { expected := []string{"hw_id", "catalog_status", "product_url", "firmware_version", "test_date", "test_data", "ai_notes", "photo_urls"} for _, name := range expected { if customFieldSpec(name) == nil { t.Errorf("missing custom field spec: %s", name) } } if len(hwlabCustomFields) != 8 { t.Errorf("want 8 custom fields, got %d", len(hwlabCustomFields)) } }