@@ -56,13 +56,13 @@ func TestVerifyAud(t *testing.T) {
56
56
57
57
for _ , test := range tests {
58
58
t .Run (test .Name , func (t * testing.T ) {
59
- var opts []ParserOption
59
+ var opts []ParserOption [ MapClaims ]
60
60
61
61
if test .Required {
62
- opts = append (opts , WithAudience (test .Comparison ))
62
+ opts = append (opts , WithAudience [ MapClaims ] (test .Comparison ))
63
63
}
64
64
65
- validator := newValidator (opts ... )
65
+ validator := newValidator [ MapClaims ] (opts ... )
66
66
got := validator .Validate (test .MapClaims )
67
67
68
68
if (got == nil ) != test .Expected {
@@ -77,7 +77,7 @@ func TestMapclaimsVerifyIssuedAtInvalidTypeString(t *testing.T) {
77
77
"iat" : "foo" ,
78
78
}
79
79
want := false
80
- got := newValidator (WithIssuedAt ()).Validate (mapClaims )
80
+ got := newValidator [ MapClaims ] (WithIssuedAt [ MapClaims ] ()).Validate (mapClaims )
81
81
if want != (got == nil ) {
82
82
t .Fatalf ("Failed to verify claims, wanted: %v got %v" , want , (got == nil ))
83
83
}
@@ -88,7 +88,7 @@ func TestMapclaimsVerifyNotBeforeInvalidTypeString(t *testing.T) {
88
88
"nbf" : "foo" ,
89
89
}
90
90
want := false
91
- got := newValidator ().Validate (mapClaims )
91
+ got := newValidator [ MapClaims ] ().Validate (mapClaims )
92
92
if want != (got == nil ) {
93
93
t .Fatalf ("Failed to verify claims, wanted: %v got %v" , want , (got == nil ))
94
94
}
@@ -99,7 +99,7 @@ func TestMapclaimsVerifyExpiresAtInvalidTypeString(t *testing.T) {
99
99
"exp" : "foo" ,
100
100
}
101
101
want := false
102
- got := newValidator ().Validate (mapClaims )
102
+ got := newValidator [ MapClaims ] ().Validate (mapClaims )
103
103
104
104
if want != (got == nil ) {
105
105
t .Fatalf ("Failed to verify claims, wanted: %v got %v" , want , (got == nil ))
@@ -112,22 +112,22 @@ func TestMapClaimsVerifyExpiresAtExpire(t *testing.T) {
112
112
"exp" : float64 (exp .Unix ()),
113
113
}
114
114
want := false
115
- got := newValidator (WithTimeFunc (func () time.Time {
115
+ got := newValidator [ MapClaims ] (WithTimeFunc [ MapClaims ] (func () time.Time {
116
116
return exp
117
117
})).Validate (mapClaims )
118
118
if want != (got == nil ) {
119
119
t .Fatalf ("Failed to verify claims, wanted: %v got %v" , want , (got == nil ))
120
120
}
121
121
122
- got = newValidator (WithTimeFunc (func () time.Time {
122
+ got = newValidator [ MapClaims ] (WithTimeFunc [ MapClaims ] (func () time.Time {
123
123
return exp .Add (1 * time .Second )
124
124
})).Validate (mapClaims )
125
125
if want != (got == nil ) {
126
126
t .Fatalf ("Failed to verify claims, wanted: %v got %v" , want , (got == nil ))
127
127
}
128
128
129
129
want = true
130
- got = newValidator (WithTimeFunc (func () time.Time {
130
+ got = newValidator [ MapClaims ] (WithTimeFunc [ MapClaims ] (func () time.Time {
131
131
return exp .Add (- 1 * time .Second )
132
132
})).Validate (mapClaims )
133
133
if want != (got == nil ) {
0 commit comments