go-waku/logging/context_test.go

22 lines
389 B
Go
Raw Normal View History

2022-07-23 12:12:56 +00:00
package logging
import (
"context"
"testing"
"github.com/stretchr/testify/require"
"go.uber.org/zap"
)
func Test_EmptyContext(t *testing.T) {
logger := From(context.Background())
require.Nil(t, logger)
}
func Test_With(t *testing.T) {
logger, err := zap.NewDevelopment()
require.NoError(t, err)
ctx := With(context.Background(), logger)
require.Equal(t, logger, From(ctx))
}