(t *testing.T)
| 174 | } |
| 175 | |
| 176 | func Test_Validator_verifySubject(t *testing.T) { |
| 177 | type fields struct { |
| 178 | expectedSub string |
| 179 | } |
| 180 | type args struct { |
| 181 | claims Claims |
| 182 | cmp string |
| 183 | required bool |
| 184 | } |
| 185 | tests := []struct { |
| 186 | name string |
| 187 | fields fields |
| 188 | args args |
| 189 | wantErr error |
| 190 | }{ |
| 191 | { |
| 192 | name: "good claim", |
| 193 | fields: fields{expectedSub: "me"}, |
| 194 | args: args{claims: MapClaims{"sub": "me"}, cmp: "me"}, |
| 195 | wantErr: nil, |
| 196 | }, |
| 197 | { |
| 198 | name: "claims with invalid type", |
| 199 | fields: fields{expectedSub: "me"}, |
| 200 | args: args{claims: MapClaims{"sub": 1}, cmp: "me"}, |
| 201 | wantErr: ErrInvalidType, |
| 202 | }, |
| 203 | } |
| 204 | for _, tt := range tests { |
| 205 | t.Run(tt.name, func(t *testing.T) { |
| 206 | v := &Validator{ |
| 207 | expectedSub: tt.fields.expectedSub, |
| 208 | } |
| 209 | err := v.verifySubject(tt.args.claims, tt.args.cmp, tt.args.required) |
| 210 | if (err != nil) && !errors.Is(err, tt.wantErr) { |
| 211 | t.Errorf("validator.verifySubject() error = %v, wantErr %v", err, tt.wantErr) |
| 212 | } |
| 213 | }) |
| 214 | } |
| 215 | } |
| 216 | |
| 217 | func Test_Validator_verifyIssuedAt(t *testing.T) { |
| 218 | type fields struct { |
nothing calls this directly
no test coverage detected