Skip to content

Commit

Permalink
test: added tests in all packages
Browse files Browse the repository at this point in the history
Adding smoke tests in all packages to circumvent go1.22 issue: golang/go#65653

Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
  • Loading branch information
fredbi committed Mar 4, 2024
1 parent 35b5892 commit 8560f81
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 0 deletions.
11 changes: 11 additions & 0 deletions internal/testing/data_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package testing

import (
"testing"

"github.com/stretchr/testify/require"
)

func TestInvalidJSON(t *testing.T) {
require.NotEmpty(t, InvalidJSONMessage)
}
14 changes: 14 additions & 0 deletions internal/testing/petstore/api_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package petstore

import (
"testing"

"github.com/stretchr/testify/require"
)

func TestAPI(t *testing.T) {
doc, api := NewAPI(t)

require.NotNil(t, doc)
require.NotNil(t, api)
}
11 changes: 11 additions & 0 deletions logger/logger_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package logger

import (
"testing"

"github.com/stretchr/testify/require"
)

func TestLogger(t *testing.T) {
require.False(t, DebugEnabled())
}
2 changes: 2 additions & 0 deletions logger/standard.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"os"
)

var _ Logger = StandardLogger{}

type StandardLogger struct{}

func (StandardLogger) Printf(format string, args ...interface{}) {
Expand Down
16 changes: 16 additions & 0 deletions middleware/header/header_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package header

import (
"net/http"
"testing"

"github.com/stretchr/testify/require"
)

func TestHeader(t *testing.T) {
hdr := http.Header{
"x-test": []string{"value"},
}
clone := Copy(hdr)
require.Len(t, clone, len(hdr))
}

0 comments on commit 8560f81

Please sign in to comment.