Skip to content

Commit ec260bf

Browse files
author
s0s01qp
committed
added test cases
1 parent e582ec3 commit ec260bf

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

‎commons/utils_test.go‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package commons_test
2+
3+
import (
4+
"github.com/stretchr/testify/assert"
5+
"testing"
6+
7+
"github.com/sinhashubham95/go-actuator/commons"
8+
)
9+
10+
func TestEncodeJSON(t *testing.T) {
11+
data := map[string]string{
12+
"naruto": "rocks",
13+
}
14+
bytes, err := commons.EncodeJSON(data)
15+
assert.NoError(t, err)
16+
assert.Contains(t, string(bytes), "naruto")
17+
}

‎go.mod‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ go 1.17
44

55
require (
66
github.com/gin-gonic/gin v1.7.2
7+
github.com/stretchr/testify v1.4.0
78
github.com/valyala/fasthttp v1.28.0
89
)
910

1011
require (
1112
github.com/andybalholm/brotli v1.0.2 // indirect
13+
github.com/davecgh/go-spew v1.1.1 // indirect
1214
github.com/gin-contrib/sse v0.1.0 // indirect
1315
github.com/go-playground/locales v0.13.0 // indirect
1416
github.com/go-playground/universal-translator v0.17.0 // indirect
@@ -20,6 +22,7 @@ require (
2022
github.com/mattn/go-isatty v0.0.12 // indirect
2123
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect
2224
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 // indirect
25+
github.com/pmezard/go-difflib v1.0.0 // indirect
2326
github.com/ugorji/go/codec v1.1.7 // indirect
2427
github.com/valyala/bytebufferpool v1.0.0 // indirect
2528
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a // indirect

0 commit comments

Comments
 (0)