Passed
Push — v3.0.0 ( 671bfc...c3fef3 )
by Serhii
01:12
created

config_test.go   A

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 21
dl 0
loc 31
c 0
b 0
f 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A timeago.TestLocationIsSet 0 25 4
1
package timeago
2
3
import (
4
	"testing"
5
)
6
7
func TestLocationIsSet(t *testing.T) {
8
	cases := []struct {
9
		name   string
10
		loc    string
11
		expect bool
12
	}{
13
		{
14
			name:   "Location is set",
15
			loc:    "Russia/Moscow",
16
			expect: true,
17
		},
18
		{
19
			name:   "Location is not set",
20
			loc:    "",
21
			expect: false,
22
		},
23
	}
24
25
	for _, tc := range cases {
26
		t.Run(tc.name, func(t *testing.T) {
27
			c := NewConfig("ru", tc.loc, []Translation{})
28
			actual := c.LocationIsSet()
29
30
			if actual != tc.expect {
31
				t.Fatalf("Expected %v, but got %v", tc.expect, actual)
32
			}
33
		})
34
	}
35
}
36