Skip to content

Commit 8560f81

Browse files
committed
test: added tests in all packages
Adding smoke tests in all packages to circumvent go1.22 issue: golang/go#65653 Signed-off-by: Frederic BIDON <[email protected]>
1 parent 35b5892 commit 8560f81

File tree

5 files changed

+54
-0
lines changed

5 files changed

+54
-0
lines changed

internal/testing/data_test.go

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package testing
2+
3+
import (
4+
"testing"
5+
6+
"github.com/stretchr/testify/require"
7+
)
8+
9+
func TestInvalidJSON(t *testing.T) {
10+
require.NotEmpty(t, InvalidJSONMessage)
11+
}

internal/testing/petstore/api_test.go

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package petstore
2+
3+
import (
4+
"testing"
5+
6+
"github.com/stretchr/testify/require"
7+
)
8+
9+
func TestAPI(t *testing.T) {
10+
doc, api := NewAPI(t)
11+
12+
require.NotNil(t, doc)
13+
require.NotNil(t, api)
14+
}

logger/logger_test.go

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package logger
2+
3+
import (
4+
"testing"
5+
6+
"github.com/stretchr/testify/require"
7+
)
8+
9+
func TestLogger(t *testing.T) {
10+
require.False(t, DebugEnabled())
11+
}

logger/standard.go

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import (
55
"os"
66
)
77

8+
var _ Logger = StandardLogger{}
9+
810
type StandardLogger struct{}
911

1012
func (StandardLogger) Printf(format string, args ...interface{}) {

middleware/header/header_test.go

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package header
2+
3+
import (
4+
"net/http"
5+
"testing"
6+
7+
"github.com/stretchr/testify/require"
8+
)
9+
10+
func TestHeader(t *testing.T) {
11+
hdr := http.Header{
12+
"x-test": []string{"value"},
13+
}
14+
clone := Copy(hdr)
15+
require.Len(t, clone, len(hdr))
16+
}

0 commit comments

Comments
 (0)