diff --git a/vc/vc_test.go b/vc/vc_test.go index 021c24c..10727e6 100644 --- a/vc/vc_test.go +++ b/vc/vc_test.go @@ -475,9 +475,11 @@ func TestCreateJWTVerifiableCredential(t *testing.T) { func TestVerifiableCredential_ValidAt(t *testing.T) { lll := time.Date(1999, 0, 0, 0, 0, 0, 0, time.UTC) hhh := time.Date(2001, 0, 0, 0, 0, 0, 0, time.UTC) + skew := time.Hour * 24 * 365 * 3 // 3 years, time difference is 2 years // no validity period is always true; includes missing IssuanceDate(.IsZero() == true) assert.True(t, VerifiableCredential{}.ValidAt(time.Now(), 0)) + assert.True(t, VerifiableCredential{}.ValidAt(time.Now(), skew)) // valid on bounds assert.True(t, VerifiableCredential{IssuanceDate: &lll, ValidFrom: &lll}.ValidAt(lll, 0)) @@ -490,7 +492,6 @@ func TestVerifiableCredential_ValidAt(t *testing.T) { assert.False(t, VerifiableCredential{ExpirationDate: &lll, ValidUntil: &hhh}.ValidAt(hhh, 0)) // invalid made valid - skew := time.Hour * 24 * 365 * 3 // 3 years, time difference is 2 years assert.True(t, VerifiableCredential{IssuanceDate: &hhh, ValidFrom: &lll}.ValidAt(lll, skew)) assert.True(t, VerifiableCredential{IssuanceDate: &lll, ValidFrom: &hhh}.ValidAt(lll, skew)) assert.True(t, VerifiableCredential{ExpirationDate: &hhh, ValidUntil: &lll}.ValidAt(hhh, skew))