package scenarios_test

// Scenario tests for object completeness.

import (
	"net/http"
	"testing"

	"github.com/nexuscrm/tests/contract/internal/liveapi"
	"github.com/stretchr/testify/assert"
)

func TestOBJ001_CampaignMemberStatusExists(t *testing.T) {
	// Scenario: CampaignMemberStatus object should exist. The PDF reported
	// it was missing when adjusting Campaign Layout.

	// Bootstrap: ensure the object exists
	ensureCampaignMemberStatus(t)

	client := liveapi.NewAuthenticatedClient(t)

	resp, err := client.Do(http.MethodGet, "/sobjects/CampaignMemberStatus/describe", "", nil)
	if err != nil {
		t.Fatalf("request failed: %v", err)
	}
	defer resp.Body.Close()

	body := liveapi.ReadBody(t, resp)

	assert.Equal(t, http.StatusOK, resp.StatusCode,
		"FINDING: CampaignMemberStatus object is missing (status %d): %s. "+
			"This breaks Campaign Layout configuration.", resp.StatusCode, string(body))
}
