Added basic test coverage for container initialization.
This commit is contained in:
parent
a33a76f8bc
commit
aa42451611
1 changed files with 30 additions and 0 deletions
30
container/container_test.go
Normal file
30
container/container_test.go
Normal file
|
|
@ -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)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue