From 62f4d0a8aea7af8c8edbf7db67fe7370a7f906a5 Mon Sep 17 00:00:00 2001 From: hunterlong Date: Wed, 26 Sep 2018 22:31:39 -0700 Subject: [PATCH] tests --- cmd/main_test.go | 4 ++-- core/core_test.go | 5 ++--- core/notifier/notifiers_test.go | 2 +- handlers/api_handlers_test.go | 4 ++-- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/cmd/main_test.go b/cmd/main_test.go index 21ba79da..805550c3 100644 --- a/cmd/main_test.go +++ b/cmd/main_test.go @@ -234,7 +234,7 @@ func RunSaveConfig(t *testing.T, db string) { } else if db == "mssql" { port = 1433 } - core.Configs = &core.DbConfig{DbConfig: &types.DbConfig{ + core.Configs = &core.DbConfig{ DbConn: db, DbHost: os.Getenv("DB_HOST"), DbUser: os.Getenv("DB_USER"), @@ -249,7 +249,7 @@ func RunSaveConfig(t *testing.T, db string) { Email: "", Error: nil, Location: dir, - }} + } core.Configs, err = core.Configs.Save() assert.Nil(t, err) } diff --git a/core/core_test.go b/core/core_test.go index 5d4112e3..8ee4e97a 100644 --- a/core/core_test.go +++ b/core/core_test.go @@ -17,7 +17,6 @@ package core import ( "github.com/hunterlong/statup/source" - "github.com/hunterlong/statup/types" "github.com/hunterlong/statup/utils" "github.com/stretchr/testify/assert" "testing" @@ -43,11 +42,11 @@ func TestNewCore(t *testing.T) { func TestDbConfig_Save(t *testing.T) { var err error - Configs = &DbConfig{&types.DbConfig{ + Configs = &DbConfig{ DbConn: "sqlite", Project: "Tester", Location: dir, - }} + } Configs, err = Configs.Save() assert.Nil(t, err) assert.Equal(t, "sqlite", Configs.DbConn) diff --git a/core/notifier/notifiers_test.go b/core/notifier/notifiers_test.go index 1ebdd245..198db827 100644 --- a/core/notifier/notifiers_test.go +++ b/core/notifier/notifiers_test.go @@ -232,7 +232,7 @@ func TestRunAllQueueAndStop(t *testing.T) { assert.Equal(t, 16, len(example.Queue)) go Queue(example) assert.Equal(t, 16, len(example.Queue)) - time.Sleep(6 * time.Second) + time.Sleep(10 * time.Second) assert.Equal(t, 6, len(example.Queue)) example.close() assert.False(t, example.IsRunning()) diff --git a/handlers/api_handlers_test.go b/handlers/api_handlers_test.go index f7e7d398..a849ccc9 100644 --- a/handlers/api_handlers_test.go +++ b/handlers/api_handlers_test.go @@ -46,10 +46,10 @@ func init() { func loadDatabase() { core.NewCore() core.LoadConfig(dir) - core.Configs = &core.DbConfig{DbConfig: &types.DbConfig{ + core.Configs = &core.DbConfig{ DbConn: "sqlite", Location: dir, - }} + } core.Configs.Connect(false, utils.Directory) core.CoreApp.DbConnection = "sqlite" core.CoreApp.Version = "DEV"