fix: lint issues

This commit is contained in:
Kevin Franklin Kim 2025-03-06 16:08:57 +01:00
parent 0a3551cb98
commit 06f4516256
No known key found for this signature in database
4 changed files with 10 additions and 8 deletions

View File

@ -35,7 +35,7 @@ Release downloads:
## How to Contribute
Make a pull request...
Please refer to the [CONTRIBUTING](.gihub/CONTRIBUTING.md) details and follow the [CODE_OF_CONDUCT](.gihub/CODE_OF_CONDUCT.md) and [SECURITY](.github/SECURITY.md) guidelines.
## License

View File

@ -12,7 +12,7 @@ import (
)
const (
HeaderServiceToService = "X-Foomo-S2S"
HeaderServiceToService = "X-Foomo-S2s"
)
// ClientTransport to use for calls

View File

@ -6,20 +6,21 @@ import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func Test_newRequest(t *testing.T) {
t.Run("custom headers", func(t *testing.T) {
headers := http.Header{}
headers.Set("test", "test")
headers.Set("Test", "test")
request, err := newRequest(context.Background(), "/test", "text/html", nil, headers)
assert.NoError(t, err)
assert.Equal(t, "test", request.Header.Get("test"))
require.NoError(t, err)
assert.Equal(t, "test", request.Header.Get("Test"))
})
t.Run("default", func(t *testing.T) {
request, err := newRequest(context.Background(), "/test", "text/html", nil, nil)
assert.NoError(t, err)
require.NoError(t, err)
assert.Equal(t, "/test", request.URL.Path)
assert.Equal(t, "text/html", request.Header.Get("Accept"))
assert.Equal(t, "text/html", request.Header.Get("Content-Type"))

View File

@ -6,6 +6,7 @@ import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
const sampleConf = `---
@ -70,13 +71,13 @@ func TestLoadConfig(t *testing.T) {
func TestLoadConfigFile_GomodAbsolute(t *testing.T) {
config, err := LoadConfigFile("testdata/gomod.absolute.yml")
assert.NoError(t, err)
require.NoError(t, err)
assert.Equal(t, "/go/src/github.com/foomo/gotsrpc", config.Module.Path)
}
func TestLoadConfigFile_GomodRelative(t *testing.T) {
config, err := LoadConfigFile("testdata/gomod.relative.yml")
assert.NoError(t, err)
require.NoError(t, err)
fmt.Println(config.Module.Path)
assert.True(t, strings.HasSuffix(config.Module.Path, "gotsrpc/config/demo"))
}