Skip to content

Commit

Permalink
fix: 🧪 add failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
jbleduigou committed Apr 3, 2024
1 parent c6cfde7 commit f5a807a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 3 additions & 1 deletion handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import (
"context"
"log/slog"
"os"
"testing"

Check failure on line 7 in handler.go

View workflow job for this annotation

GitHub Actions / Build

"testing" imported and not used

"github.com/aws/aws-lambda-go/lambdacontext"
"github.com/stretchr/testify/assert"

Check failure on line 10 in handler.go

View workflow job for this annotation

GitHub Actions / Build

"github.com/stretchr/testify/assert" imported and not used
)

type LambdaHandler struct {
Expand Down Expand Up @@ -50,4 +52,4 @@ func getLogLevel() slog.Leveler {
}

return l
}
}
9 changes: 9 additions & 0 deletions handler_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package slogawslambda

import (
"context"
"log/slog"
"os"
"testing"
Expand Down Expand Up @@ -49,3 +50,11 @@ func TestGetLogLevel(t *testing.T) {
})
}
}

func TestUsingNonAwsContextShouldNotError(t *testing.T) {
ctx := context.Background()

h := NewAWSLambdaHandler(ctx, nil)

assert.NotNil(t, h)
}

0 comments on commit f5a807a

Please sign in to comment.