package server

import (
  "testing"
  "git.mchus.pro/mchus/logpile/internal/models"
)

func TestNormalizePCIeSerialComponentName_PrefersPartOverGenericClass(t *testing.T) {
  got := normalizePCIeSerialComponentName(models.PCIeDevice{DeviceClass:"Display Controller", PartNumber:"GH100 [H200 NVL]"})
  if got != "GH100 [H200 NVL]" {
    t.Fatalf("expected part number, got %q", got)
  }
}

func TestNormalizePCIeSerialComponentName_UsesClassWhenSpecific(t *testing.T) {
  got := normalizePCIeSerialComponentName(models.PCIeDevice{DeviceClass:"I350 Gigabit Network Connection", PartNumber:"I350T4V2"})
  if got != "I350T4V2" {
    t.Fatalf("expected part number for readability, got %q", got)
  }
}
