package invocation

import (
	"testing"

	"github.com/stretchr/testify/require"
)

func TestAcceptanceMemberIDsUseOneDeterministicGlobalOrder(t *testing.T) {
	// Semantic roles intentionally arrive in an order that differs from their
	// member ids, with owner repeated as principal. Every acceptance must lock
	// the same physical rows in this one global order regardless of which
	// Binding supplied each role.
	require.Equal(t,
		[]string{"mem_agent_a", "mem_owner_m", "mem_principal_z"},
		sortedUniqueNonEmpty([]string{
			"mem_principal_z",
			"mem_owner_m",
			"mem_agent_a",
			"mem_owner_m",
			" ",
		}),
	)
}
