diff options
Diffstat (limited to 'app/domain/sparkle_test.go')
| -rw-r--r-- | app/domain/sparkle_test.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/app/domain/sparkle_test.go b/app/domain/sparkle_test.go index 8d81afd..c040d89 100644 --- a/app/domain/sparkle_test.go +++ b/app/domain/sparkle_test.go @@ -1,9 +1,12 @@ package domain import ( + "fmt" "testing" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/xlgmokha/x/pkg/x" ) func TestSparkle(t *testing.T) { @@ -48,4 +51,16 @@ func TestSparkle(t *testing.T) { } }) }) + + t.Run("ToObjectReference", func(t *testing.T) { + t.Run("returns a valid object reference", func(t *testing.T) { + sparkle := x.New[*Sparkle](WithULID[*Sparkle]()) + reference := sparkle.ToObjectReference() + + require.NotNil(t, reference) + require.NoError(t, reference.Validate()) + require.NoError(t, reference.ValidateAll()) + assert.Equal(t, fmt.Sprintf("object_type:\"sparkle\" object_id:\"%s\"", sparkle.ID), reference.String()) + }) + }) } |
