package platform

import (
	"encoding/json"
	"strings"
	"testing"
)

func TestRemovableTargetJSONUsesFrontendFieldNames(t *testing.T) {
	t.Parallel()

	data, err := json.Marshal(RemovableTarget{
		Device: "/dev/sdb1",
		FSType: "exfat",
		Size:   "1.8T",
		Label:  "USB",
		Model:  "Flash",
	})
	if err != nil {
		t.Fatalf("marshal: %v", err)
	}
	raw := string(data)
	for _, key := range []string{`"device"`, `"fs_type"`, `"size"`, `"label"`, `"model"`} {
		if !strings.Contains(raw, key) {
			t.Fatalf("json missing key %s: %s", key, raw)
		}
	}
	if strings.Contains(raw, `"Device"`) || strings.Contains(raw, `"FSType"`) {
		t.Fatalf("json still contains Go field names: %s", raw)
	}
}
