| Conditions | 4 |
| Total Lines | 25 |
| Code Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | package timeago |
||
| 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 | } |
||
| 36 |