Add test for country model
This commit is contained in:
parent
67c21ab0d1
commit
2eb0011377
1 changed files with 21 additions and 0 deletions
21
internal/models/country_test.go
Normal file
21
internal/models/country_test.go
Normal file
|
@ -0,0 +1,21 @@
|
|||
package models
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestNewCountry(t *testing.T) {
|
||||
t.Run("name Fantasy code fy", func(t *testing.T) {
|
||||
country := NewCountry("fy", "Fantasy")
|
||||
assert.Equal(t, "fy", country.ID)
|
||||
assert.Equal(t, "Fantasy", country.CountryName)
|
||||
assert.Equal(t, "fantasy", country.CountrySlug)
|
||||
})
|
||||
t.Run("name Unknown code Unknown", func(t *testing.T) {
|
||||
country := NewCountry("", "")
|
||||
assert.Equal(t, "zz", country.ID)
|
||||
assert.Equal(t, "Unknown", country.CountryName)
|
||||
assert.Equal(t, "unknown", country.CountrySlug)
|
||||
})
|
||||
}
|
Loading…
Reference in a new issue