Browse Source

Remove .gitignore file

Fixed unit tests
dependabot/npm_and_yarn/web/prismjs-1.21.0
Max Schmitt 8 years ago
parent
commit
a7037d7551
  1. 2
      handlers/auth_test.go
  2. 6735
      static/yarn.lock
  3. 12
      store/store_test.go

2
handlers/auth_test.go

@ -44,7 +44,7 @@ func TestCreateBackend(t *testing.T) {
store, err := store.New(config.Store{ store, err := store.New(config.Store{
DBPath: testingDBName, DBPath: testingDBName,
ShortedIDLength: 4, ShortedIDLength: 4,
}) }, logrus.New())
if err != nil { if err != nil {
t.Fatalf("could not create store: %v", err) t.Fatalf("could not create store: %v", err)
} }

6735
static/yarn.lock

File diff suppressed because it is too large

12
store/store_test.go

@ -5,6 +5,8 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/sirupsen/logrus"
"github.com/maxibanki/golang-url-shortener/config" "github.com/maxibanki/golang-url-shortener/config"
) )
@ -41,13 +43,13 @@ func TestGenerateRandomString(t *testing.T) {
func TestNewStore(t *testing.T) { func TestNewStore(t *testing.T) {
t.Run("create store without file name provided", func(r *testing.T) { t.Run("create store without file name provided", func(r *testing.T) {
_, err := New(config.Store{}) _, err := New(config.Store{}, logrus.New())
if !strings.Contains(err.Error(), "could not open bolt DB database") { if !strings.Contains(err.Error(), "could not open bolt DB database") {
t.Fatalf("unexpected error: %v", err) t.Fatalf("unexpected error: %v", err)
} }
}) })
t.Run("create store with correct arguments", func(r *testing.T) { t.Run("create store with correct arguments", func(r *testing.T) {
store, err := New(validConfig) store, err := New(validConfig, logrus.New())
if err != nil { if err != nil {
t.Fatalf("unexpected error: %v", err) t.Fatalf("unexpected error: %v", err)
} }
@ -59,7 +61,7 @@ func TestCreateEntry(t *testing.T) {
store, err := New(config.Store{ store, err := New(config.Store{
DBPath: testingDBName, DBPath: testingDBName,
ShortedIDLength: 1, ShortedIDLength: 1,
}) }, logrus.New())
if err != nil { if err != nil {
t.Fatalf("unexpected error: %v", err) t.Fatalf("unexpected error: %v", err)
} }
@ -77,7 +79,7 @@ func TestCreateEntry(t *testing.T) {
} }
func TestGetEntryByID(t *testing.T) { func TestGetEntryByID(t *testing.T) {
store, err := New(validConfig) store, err := New(validConfig, logrus.New())
if err != nil { if err != nil {
t.Fatalf("unexpected error: %v", err) t.Fatalf("unexpected error: %v", err)
} }
@ -93,7 +95,7 @@ func TestGetEntryByID(t *testing.T) {
} }
func TestIncreaseVisitCounter(t *testing.T) { func TestIncreaseVisitCounter(t *testing.T) {
store, err := New(validConfig) store, err := New(validConfig, logrus.New())
if err != nil { if err != nil {
t.Fatalf("could not create store: %v", err) t.Fatalf("could not create store: %v", err)
} }

Loading…
Cancel
Save