(t *testing.T)
| 89 | } |
| 90 | |
| 91 | func Test_Validator_verifyExpiresAt(t *testing.T) { |
| 92 | type fields struct { |
| 93 | leeway time.Duration |
| 94 | timeFunc func() time.Time |
| 95 | } |
| 96 | type args struct { |
| 97 | claims Claims |
| 98 | cmp time.Time |
| 99 | required bool |
| 100 | } |
| 101 | tests := []struct { |
| 102 | name string |
| 103 | fields fields |
| 104 | args args |
| 105 | wantErr error |
| 106 | }{ |
| 107 | { |
| 108 | name: "good claim", |
| 109 | fields: fields{timeFunc: time.Now}, |
| 110 | args: args{claims: RegisteredClaims{ExpiresAt: NewNumericDate(time.Now().Add(10 * time.Minute))}}, |
| 111 | wantErr: nil, |
| 112 | }, |
| 113 | { |
| 114 | name: "claims with invalid type", |
| 115 | fields: fields{}, |
| 116 | args: args{claims: MapClaims{"exp": "string"}}, |
| 117 | wantErr: ErrInvalidType, |
| 118 | }, |
| 119 | } |
| 120 | for _, tt := range tests { |
| 121 | t.Run(tt.name, func(t *testing.T) { |
| 122 | v := &Validator{ |
| 123 | leeway: tt.fields.leeway, |
| 124 | timeFunc: tt.fields.timeFunc, |
| 125 | } |
| 126 | |
| 127 | err := v.verifyExpiresAt(tt.args.claims, tt.args.cmp, tt.args.required) |
| 128 | if (err != nil) && !errors.Is(err, tt.wantErr) { |
| 129 | t.Errorf("validator.verifyExpiresAt() error = %v, wantErr %v", err, tt.wantErr) |
| 130 | } |
| 131 | }) |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | func Test_Validator_verifyIssuer(t *testing.T) { |
| 136 | type fields struct { |
nothing calls this directly
no test coverage detected