Passed
Pull Request — master (#9)
by Serhii
01:51
created

timeago.TestGetTimeTranslations   B

Complexity

Conditions 6

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 6
eloc 9
nop 1
dl 0
loc 13
rs 8.6666
c 0
b 0
f 0
1
package timeago
2
3
import "testing"
4
5
func TestGetTimeTranslations(t *testing.T) {
6
	t.Parallel()
7
8
	t.Run("returns 7 items", func(test *testing.T) {
9
		if res := len(getTimeTranslations()); res != 7 {
10
			test.Errorf("Must return 7 items but got %d", res)
11
		}
12
	})
13
14
	t.Run("every slice has 3 items", func(test *testing.T) {
15
		for _, slice := range getTimeTranslations() {
16
			if res := len(slice); res != 3 {
17
				test.Errorf("Slice Must return 3 items but got %d", res)
18
			}
19
		}
20
	})
21
}
22