Skip to content

Commit

Permalink
added test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
s0s01qp committed Jul 18, 2021
1 parent e582ec3 commit ec260bf
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
17 changes: 17 additions & 0 deletions commons/utils_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package commons_test

import (
"github.com/stretchr/testify/assert"
"testing"

"github.com/sinhashubham95/go-actuator/commons"
)

func TestEncodeJSON(t *testing.T) {
data := map[string]string{
"naruto": "rocks",
}
bytes, err := commons.EncodeJSON(data)
assert.NoError(t, err)
assert.Contains(t, string(bytes), "naruto")
}
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ go 1.17

require (
github.com/gin-gonic/gin v1.7.2
github.com/stretchr/testify v1.4.0
github.com/valyala/fasthttp v1.28.0
)

require (
github.com/andybalholm/brotli v1.0.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-playground/locales v0.13.0 // indirect
github.com/go-playground/universal-translator v0.17.0 // indirect
Expand All @@ -20,6 +22,7 @@ require (
github.com/mattn/go-isatty v0.0.12 // indirect
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/ugorji/go/codec v1.1.7 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a // indirect
Expand Down

0 comments on commit ec260bf

Please sign in to comment.