From aa424516111a003a0792166a665cc01f06c5b355 Mon Sep 17 00:00:00 2001 From: mikestefanello Date: Wed, 15 Dec 2021 09:32:27 -0500 Subject: [PATCH] Added basic test coverage for container initialization. --- container/container_test.go | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 container/container_test.go diff --git a/container/container_test.go b/container/container_test.go new file mode 100644 index 0000000..6f1af4d --- /dev/null +++ b/container/container_test.go @@ -0,0 +1,30 @@ +package container + +import ( + "os" + "testing" + + "goweb/config" + + "github.com/stretchr/testify/assert" +) + +func TestMain(m *testing.M) { + // Set the environment to test + config.SwitchEnvironment(config.EnvTest) + + // Run tests + exitVal := m.Run() + os.Exit(exitVal) +} + +func TestNewContainer(t *testing.T) { + c := NewContainer() + assert.NotNil(t, c.Web) + assert.NotNil(t, c.Config) + assert.NotNil(t, c.Cache) + assert.NotNil(t, c.Database) + assert.NotNil(t, c.ORM) + assert.NotNil(t, c.Mail) + assert.NotNil(t, c.Auth) +}