package domain_test

import (
	"testing"

	"gitea.dwysokinski.me/twhelp/corev3/internal/domain"
	"gitea.dwysokinski.me/twhelp/corev3/internal/domain/domaintest"
	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/require"
)

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

	server := domaintest.NewServer(t)

	payload, err := domain.NewSyncEnnoblementsCmdPayload(
		server.Key(),
		server.URL(),
		server.VersionCode(),
	)
	require.NoError(t, err)
	assert.Equal(t, server.Key(), payload.ServerKey())
	assert.Equal(t, server.URL(), payload.ServerURL())
	assert.Equal(t, server.VersionCode(), payload.VersionCode())
}

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

	server := domaintest.NewServer(t)

	payload, err := domain.NewEnnoblementsSyncedEventPayload(
		server.Key(),
		server.URL(),
		server.VersionCode(),
	)
	require.NoError(t, err)
	assert.Equal(t, server.Key(), payload.ServerKey())
	assert.Equal(t, server.URL(), payload.ServerURL())
	assert.Equal(t, server.VersionCode(), payload.VersionCode())
}
