Skip to content

Commit

Permalink
Fix wasm package as well
Browse files Browse the repository at this point in the history
  • Loading branch information
tstirrat15 committed Oct 30, 2024
1 parent 8494c92 commit ac39490
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions pkg/wasm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,12 @@ func runZedCommand(rootCmd *cobra.Command, requestContextJSON string, stringPara
if err != nil {
return zedCommandResult{Error: err.Error()}
}
defer it.Close()

for rel := it.Next(); rel != nil; rel = it.Next() {
relationships = append(relationships, rel)
for rel, err := range it {
if err != nil {
return zedCommandResult{Error: err.Error()}
}
relationships = append(relationships, rel.ToCoreTuple())
}
it.Close()
}

caveatDefs, err := reader.ListAllCaveats(ctx)
Expand Down
8 changes: 4 additions & 4 deletions pkg/wasm/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ func TestZedCommand(t *testing.T) {
}`,

Relationships: []*v1.RelationTuple{
tuple.MustParse(`document:first#viewer@user:fred[somecaveat:{"somecondition": 42}]`),
tuple.MustParse("document:first#viewer@user:tom"),
tuple.MustParse(`document:first#viewer@user:fred[somecaveat:{"somecondition": 42}]`).ToCoreTuple(),
tuple.MustParse("document:first#viewer@user:tom").ToCoreTuple(),
},
}

Expand All @@ -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}]`, tuple.MustString(updatedContext.Relationships[0]))
require.Equal(t, "document:first#viewer@user:tom", tuple.MustString(updatedContext.Relationships[1]))
require.Equal(t, `document:first#viewer@user:fred[somecaveat:{"somecondition":42}]`, tuple.CoreRelationToString(updatedContext.Relationships[0]))
require.Equal(t, "document:first#viewer@user:tom", tuple.CoreRelationToString(updatedContext.Relationships[1]))
require.Len(t, updatedContext.Relationships, 2)

// Run the actual command.
Expand Down

0 comments on commit ac39490

Please sign in to comment.