(t *testing.T)
| 7 | ) |
| 8 | |
| 9 | func Test_joinErrors(t *testing.T) { |
| 10 | type args struct { |
| 11 | errs []error |
| 12 | } |
| 13 | tests := []struct { |
| 14 | name string |
| 15 | args args |
| 16 | wantErrors []error |
| 17 | wantMessage string |
| 18 | }{ |
| 19 | { |
| 20 | name: "multiple errors", |
| 21 | args: args{ |
| 22 | errs: []error{ErrTokenNotValidYet, ErrTokenExpired}, |
| 23 | }, |
| 24 | wantErrors: []error{ErrTokenNotValidYet, ErrTokenExpired}, |
| 25 | wantMessage: "token is not valid yet, token is expired", |
| 26 | }, |
| 27 | } |
| 28 | for _, tt := range tests { |
| 29 | t.Run(tt.name, func(t *testing.T) { |
| 30 | err := joinErrors(tt.args.errs...) |
| 31 | for _, wantErr := range tt.wantErrors { |
| 32 | if !errors.Is(err, wantErr) { |
| 33 | t.Errorf("joinErrors() error = %v, does not contain %v", err, wantErr) |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | if err.Error() != tt.wantMessage { |
| 38 | t.Errorf("joinErrors() error.Error() = %v, wantMessage %v", err, tt.wantMessage) |
| 39 | } |
| 40 | }) |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | func Test_newError(t *testing.T) { |
| 45 | type args struct { |
nothing calls this directly
no test coverage detected