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

config/config_test.go   A

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 20
dl 0
loc 29
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A config.TestLocationIsSet 0 25 4
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