Skip to content

Commit

Permalink
Repo findall test added
Browse files Browse the repository at this point in the history
  • Loading branch information
milosgagovic committed Oct 23, 2023
1 parent 6b9b226 commit b115308
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions domain/redirectdefinition/repository/repository_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package redirectrepository_test

import (
"context"
"fmt"
"testing"

keelmongo "github.com/foomo/keel/persistence/mongo"
redirectrepository "github.com/foomo/redirects/domain/redirectdefinition/repository"
"github.com/stretchr/testify/assert"
"go.opentelemetry.io/contrib/instrumentation/go.mongodb.org/mongo-driver/mongo/otelmongo"
"go.uber.org/zap"
)

func TestGetAllRedirects(t *testing.T) {
l := zap.L()
mongoURI := "mongodb://localhost:27017/local"
remotePersistor, err := keelmongo.New(
context.Background(),
mongoURI,
keelmongo.WithOtelOptions(
otelmongo.WithCommandAttributeDisabled(true),
),
)
assert.NoError(t, err)
// create repository
repo, err := redirectrepository.NewRedirectsDefinitionRepository(l, remotePersistor)
if err != nil {
fmt.Print(err)
}
redirectDefinitions, err := repo.FindAll(context.Background())
assert.Equal(t, 0, len(*redirectDefinitions))
assert.NoError(t, err)

}

0 comments on commit b115308

Please sign in to comment.