Passed
Push — v3.0.0 ( 5114d0...106d94 )
by Serhii
01:21
created

config.TestLocationIsSet   A

Complexity

Conditions 4

Size

Total Lines 25
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 18
dl 0
loc 25
rs 9.5
c 0
b 0
f 0
nop 1
1
package config
2
3
import "testing"
4
5
func TestLocationIsSet(t *testing.T) {
6
	cases := []struct {
7
		name   string
8
		loc    string
9
		expect bool
10
	}{
11
		{
12
			name:   "Location is set",
13
			loc:    "Russia/Moscow",
14
			expect: true,
15
		},
16
		{
17
			name:   "Location is not set",
18
			loc:    "",
19
			expect: false,
20
		},
21
	}
22
23
	for _, tc := range cases {
24
		t.Run(tc.name, func(t *testing.T) {
25
			c := New("ru", tc.loc, []Translation{})
26
			actual := c.LocationIsSet()
27
28
			if actual != tc.expect {
29
				t.Fatalf("Expected %v, but got %v", tc.expect, actual)
30
			}
31
		})
32
	}
33
}
34