Skip to content

Commit

Permalink
Use new helper
Browse files Browse the repository at this point in the history
  • Loading branch information
tstirrat15 committed Oct 30, 2024
1 parent 9609297 commit 17cefb9
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions pkg/wasm/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ func TestZedCommand(t *testing.T) {
require.NoError(t, err)

require.Contains(t, updatedContext.Schema, "definition document")
require.Equal(t, `document:first#viewer@user:fred[somecaveat:{"somecondition":42}]`, stringifyTuple(updatedContext.Relationships[0]))
require.Equal(t, "document:first#viewer@user:tom", stringifyTuple(updatedContext.Relationships[1]))
require.Equal(t, `document:first#viewer@user:fred[somecaveat:{"somecondition":42}]`, tuple.MustCoreRelationToString(updatedContext.Relationships[0]))
require.Equal(t, "document:first#viewer@user:tom", tuple.MustCoreRelationToString(updatedContext.Relationships[1]))
require.Len(t, updatedContext.Relationships, 2)

// Run the actual command.
Expand All @@ -69,9 +69,3 @@ func TestZedCommand(t *testing.T) {
require.NoError(t, err)
require.Len(t, updatedContext.Relationships, 3)
}

// NOTE: this is required to preserve caveat context.
// tuple.CoreRelationToString elides the caveat context.
func stringifyTuple(relationtuple *v1.RelationTuple) string {
return tuple.MustString(tuple.FromCoreRelationTuple(relationtuple))
}

0 comments on commit 17cefb9

Please sign in to comment.