test(invocation): add command.Covers and subject consistency tests

Also improve the maintainability of the tests by a) providing a set of fixed Personas
and then generating a slew of valid delegation tokens, invalid delegation tokens
and proof-chains thereof.
This commit is contained in:
Steve Moyer
2024-11-19 14:35:46 -05:00
parent bb36d61d93
commit 1098e76cba
32 changed files with 891 additions and 295 deletions

View File

@@ -0,0 +1,20 @@
// Package policytest provides values and functions that are useful when
// testing code that relies on Policies.
package policytest
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/ucan-wg/go-ucan/pkg/policy"
)
// EmptyPolicy provides a policy with no statements for testing purposes.
func EmptyPolicy(t *testing.T) policy.Policy {
t.Helper()
pol, err := policy.FromDagJson("[]")
require.NoError(t, err)
return pol
}