Skip to content
This repository was archived by the owner on Sep 2, 2024. It is now read-only.

Commit 92327f0

Browse files
committed
test: update tests because added logger
1 parent 3b488e3 commit 92327f0

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

extras_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"testing"
1212

1313
"github.com/staticbackendhq/core/config"
14+
"github.com/staticbackendhq/core/logger"
1415
"github.com/staticbackendhq/core/middleware"
1516
"github.com/staticbackendhq/core/sms"
1617
)
@@ -62,6 +63,8 @@ func TestUploadAndResizeImage(t *testing.T) {
6263
middleware.RequireAuth(datastore, volatile),
6364
}
6465

66+
extexec.log = logger.Get(config.Current)
67+
6568
h := middleware.Chain(http.HandlerFunc(extexec.resizeImage), stdAuth...)
6669

6770
h.ServeHTTP(resp, req)

main_test.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616
"github.com/staticbackendhq/core/database/postgresql"
1717
"github.com/staticbackendhq/core/email"
1818
"github.com/staticbackendhq/core/internal"
19+
"github.com/staticbackendhq/core/logger"
1920
"github.com/staticbackendhq/core/storage"
2021
)
2122

@@ -43,7 +44,9 @@ var (
4344
func TestMain(m *testing.M) {
4445
config.Current = config.LoadConfig()
4546

46-
volatile = cache.NewCache()
47+
logz := logger.Get(config.Current)
48+
49+
volatile = cache.NewCache(logz)
4750

4851
storer = storage.Local{}
4952

@@ -53,19 +56,19 @@ func TestMain(m *testing.M) {
5356
log.Fatal(err)
5457
}
5558

56-
datastore = mongo.New(cl, volatile.PublishDocument)
59+
datastore = mongo.New(cl, volatile.PublishDocument, logz)
5760
} else {
5861
dbConn, err := openPGDatabase("user=postgres password=postgres dbname=postgres sslmode=disable")
5962
if err != nil {
6063
log.Fatal(err)
6164
}
6265

63-
datastore = postgresql.New(dbConn, volatile.PublishDocument, "./sql/")
66+
datastore = postgresql.New(dbConn, volatile.PublishDocument, "./sql/", logz)
6467
}
6568

66-
database = &Database{cache: volatile}
69+
database = &Database{cache: volatile, log: logz}
6770

68-
mship = &membership{}
71+
mship = &membership{log: logz}
6972

7073
mp := config.Current.MailProvider
7174
if strings.EqualFold(mp, internal.MailProviderSES) {
@@ -80,7 +83,7 @@ func TestMain(m *testing.M) {
8083
go hub.run()
8184

8285
ws := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
83-
serveWs(hub, w, r)
86+
serveWs(logz, hub, w, r)
8487
}))
8588
defer ws.Close()
8689

0 commit comments

Comments
 (0)