(t *testing.T)
| 215 | } |
| 216 | |
| 217 | func Test_Validator_verifyIssuedAt(t *testing.T) { |
| 218 | type fields struct { |
| 219 | leeway time.Duration |
| 220 | timeFunc func() time.Time |
| 221 | verifyIat bool |
| 222 | } |
| 223 | type args struct { |
| 224 | claims Claims |
| 225 | cmp time.Time |
| 226 | required bool |
| 227 | } |
| 228 | tests := []struct { |
| 229 | name string |
| 230 | fields fields |
| 231 | args args |
| 232 | wantErr error |
| 233 | }{ |
| 234 | { |
| 235 | name: "good claim without iat", |
| 236 | fields: fields{verifyIat: true}, |
| 237 | args: args{claims: MapClaims{}, required: false}, |
| 238 | wantErr: nil, |
| 239 | }, |
| 240 | { |
| 241 | name: "good claim with iat", |
| 242 | fields: fields{verifyIat: true}, |
| 243 | args: args{ |
| 244 | claims: RegisteredClaims{IssuedAt: NewNumericDate(time.Now())}, |
| 245 | cmp: time.Now().Add(10 * time.Minute), |
| 246 | required: false, |
| 247 | }, |
| 248 | wantErr: nil, |
| 249 | }, |
| 250 | } |
| 251 | for _, tt := range tests { |
| 252 | t.Run(tt.name, func(t *testing.T) { |
| 253 | v := &Validator{ |
| 254 | leeway: tt.fields.leeway, |
| 255 | timeFunc: tt.fields.timeFunc, |
| 256 | verifyIat: tt.fields.verifyIat, |
| 257 | } |
| 258 | if err := v.verifyIssuedAt(tt.args.claims, tt.args.cmp, tt.args.required); (err != nil) && !errors.Is(err, tt.wantErr) { |
| 259 | t.Errorf("validator.verifyIssuedAt() error = %v, wantErr %v", err, tt.wantErr) |
| 260 | } |
| 261 | }) |
| 262 | } |
| 263 | } |
| 264 | |
| 265 | func Test_Validator_requireNotBefore(t *testing.T) { |
| 266 | type fields struct { |
nothing calls this directly
no test coverage detected