diff options
| author | mo khan <mo@mokhan.ca> | 2025-07-24 16:59:43 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-07-24 16:59:43 -0600 |
| commit | a3496a1114c6958aa1831af5348d7340e29ebf06 (patch) | |
| tree | e467d6d54a4a16ac0002bad784b7c3a1dd9fe0bd /app/domain/entity_test.go | |
| parent | 0babaa518db6cbdc17779e9c4846a8a277d098b7 (diff) | |
refactor: delegate to GlobalID to provide object references
Diffstat (limited to 'app/domain/entity_test.go')
| -rw-r--r-- | app/domain/entity_test.go | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/app/domain/entity_test.go b/app/domain/entity_test.go index 3f4c788..1ac1d26 100644 --- a/app/domain/entity_test.go +++ b/app/domain/entity_test.go @@ -5,7 +5,6 @@ import ( "testing" "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" "github.com/xlgmokha/x/pkg/x" ) @@ -30,26 +29,12 @@ func TestEntity(t *testing.T) { assert.Equal(t, id, example.GetID()) }) - }) t.Run("ToGID", func(t *testing.T) { example := x.New[*example](WithULID[*example]()) gid := example.ToGID() - assert.Equal(t, fmt.Sprintf("gid://sparkle/Entity/%s", example.ID), gid) - }) - - t.Run("ToObjectReference", func(t *testing.T) { - t.Run("returns a valid object reference", func(t *testing.T) { - example := x.New[*example](WithULID[*example]()) - reference := example.ToObjectReference() - - require.NotNil(t, reference) - require.NoError(t, reference.Validate()) - require.NoError(t, reference.ValidateAll()) - assert.Equal(t, example.ID.String(), reference.GetObjectId()) - assert.Equal(t, "entity", reference.GetObjectType()) - }) + assert.Equal(t, fmt.Sprintf("gid://sparkle/Entity/%s", example.ID), gid.String()) }) } |
