From 2eb00113770ad2a4fc45680bc2c886fdc12a8d90 Mon Sep 17 00:00:00 2001 From: Theresa Gresch Date: Tue, 16 Jul 2019 12:53:23 +0200 Subject: [PATCH] Add test for country model --- internal/models/country_test.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 internal/models/country_test.go diff --git a/internal/models/country_test.go b/internal/models/country_test.go new file mode 100644 index 000000000..4db8d1f2a --- /dev/null +++ b/internal/models/country_test.go @@ -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) + }) +}