GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Branch feature/payments-resource-impl... (bdb051)
by Victor Hugo
02:14
created

mollie/currency_test.go   A

Size/Duplication

Total Lines 80
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
cc 8
eloc 58
dl 0
loc 80
rs 10
c 0
b 0
f 0
1
package mollie
2
3
import (
4
	"reflect"
5
	"testing"
6
)
7
8
func TestNewCurrency(t *testing.T) {
9
	type args struct {
10
		code  string
11
		value string
12
	}
13
	tests := []struct {
14
		name    string
15
		args    args
16
		want    Currency
17
		wantErr bool
18
		err     error
19
	}{
20
		{
21
			name: "test a currency is correctly instantiated",
22
			args: args{
23
				code:  "MXN",
24
				value: "1000.00",
25
			},
26
			want: Currency{
27
				CurrencyCode: "MXN",
28
				Value:        "1000.00",
29
			},
30
			wantErr: false,
31
			err:     nil,
32
		},
33
		{
34
			name: "test invalid alpha3 code returns error",
35
			args: args{
36
				code:  "Mexican peso",
37
				value: "1000.00",
38
			},
39
			want:    Currency{},
40
			wantErr: true,
41
			err:     errInvalidISO4217Code,
42
		},
43
		{
44
			name: "test an empty currency code defaults to EUR",
45
			args: args{
46
				code:  "",
47
				value: "1000.00",
48
			},
49
			want: Currency{
50
				CurrencyCode: "EUR",
51
				Value:        "1000.00",
52
			},
53
			wantErr: false,
54
			err:     nil,
55
		},
56
		{
57
			name: "test a string containing a space as currency code defaults to EUR",
58
			args: args{
59
				code:  " ",
60
				value: "1000.00",
61
			},
62
			want: Currency{
63
				CurrencyCode: "EUR",
64
				Value:        "1000.00",
65
			},
66
			wantErr: false,
67
			err:     nil,
68
		},
69
	}
70
71
	for _, tt := range tests {
72
		t.Run(tt.name, func(t *testing.T) {
73
			got, err := NewCurrency(tt.args.code, tt.args.value)
74
			if tt.wantErr && err != nil {
75
				if tt.err.Error() != err.Error() {
76
					t.Errorf("error mismatch, got: %v | want %v", err, tt.err)
77
				}
78
			} else {
79
				if !reflect.DeepEqual(got, tt.want) || err != nil {
80
					t.Errorf("expectation mismatch: got %v | want: %v", got, tt.want)
81
				}
82
			}
83
		})
84
	}
85
}
86