77 "github.com/alanshaw/ucantone/examples/types"
88 "github.com/alanshaw/ucantone/ipld/datamodel"
99 "github.com/alanshaw/ucantone/principal/ed25519"
10- "github.com/alanshaw/ucantone/ucan/command"
1110 "github.com/alanshaw/ucantone/ucan/delegation"
1211 "github.com/alanshaw/ucantone/ucan/delegation/policy"
1312 "github.com/alanshaw/ucantone/ucan/invocation"
@@ -19,9 +18,9 @@ func TestCapabilityDefinition(t *testing.T) {
1918 // you get a typed Delegate and Invoke method (see below).
2019 // i.e. the args parameter for those methods is the type you define here.
2120 messageSendCapability , err := capability .New [* types.MessageSendArguments ](
22- must ( command . Parse ( "/message/send" )) ,
23- capability .WithPolicy (
24- must ( policy .Build ( policy . NotEqual (".to" , []string {})) ),
21+ "/message/send" ,
22+ capability .WithPolicyBuilder (
23+ policy .NotEqual (".to" , []string {}),
2524 ),
2625 )
2726 if err != nil {
@@ -76,7 +75,7 @@ func TestCapabilityDefinitionGenericMap(t *testing.T) {
7675 // i.e. no information about what keys can be added and no type information
7776 // for values.
7877 messageSendCapability , err := capability .New [* datamodel.Map ](
79- must ( command . Parse ( "/message/send" )) ,
78+ "/message/send" ,
8079 capability .WithPolicyBuilder (
8180 policy .NotEqual (".to" , []string {}),
8281 ),
@@ -127,10 +126,3 @@ func TestCapabilityDefinitionGenericMap(t *testing.T) {
127126 // Now, send the invocation to the service. You'll probably want to put the
128127 // invocation and delegation in a Container and send a HTTP request...
129128}
130-
131- func must [T any ](v T , err error ) T {
132- if err != nil {
133- panic (err )
134- }
135- return v
136- }
0 commit comments