Skip to content

Commit 10592aa

Browse files
committed
test: Unify unit test format
1 parent 03d8e7e commit 10592aa

File tree

5 files changed

+470
-304
lines changed

5 files changed

+470
-304
lines changed

constellation_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ func TestCarbon_Constellation(t *testing.T) {
5050

5151
t.Run("empty resources", func(t *testing.T) {
5252
lang := NewLanguage()
53-
resources := map[string]string{}
54-
lang.SetResources(resources)
53+
lang.SetResources(map[string]string{})
5554
assert.Error(t, lang.Error)
5655
c := Parse("2020-01-05").SetLanguage(lang)
5756
assert.Empty(t, c.Constellation())

language_test.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,11 @@ func TestLanguage_SetResources(t *testing.T) {
7878
})
7979

8080
t.Run("set some resources", func(t *testing.T) {
81-
resources := map[string]string{
81+
lang := NewLanguage()
82+
lang.SetLocale("en").SetResources(map[string]string{
8283
"months": "Ⅰ月|Ⅱ月|Ⅲ月|Ⅳ月|Ⅴ月|Ⅵ月|Ⅶ月|Ⅷ月|Ⅸ月|Ⅹ月|Ⅺ月|Ⅻ月",
8384
"short_months": "Ⅰ|Ⅱ|Ⅲ|Ⅳ|Ⅴ|Ⅵ|Ⅶ|Ⅷ|Ⅸ|Ⅹ|Ⅺ|Ⅻ",
84-
}
85-
86-
lang := NewLanguage()
87-
lang.SetLocale("en").SetResources(resources)
85+
})
8886

8987
assert.Equal(t, "Leo", Parse("2020-08-05").SetLanguage(lang).Constellation())
9088
assert.Equal(t, "Summer", Parse("2020-08-05").SetLanguage(lang).Season())

0 commit comments

Comments
 (0)