From ccd6cb46d26edf87cfb85f436b0e37c48e4bbf0c Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Tue, 16 Aug 2022 20:05:31 +0200 Subject: [PATCH] Adding src/utils/json_test.go --- src/utils/json_test.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/utils/json_test.go diff --git a/src/utils/json_test.go b/src/utils/json_test.go new file mode 100644 index 0000000..81a9b3d --- /dev/null +++ b/src/utils/json_test.go @@ -0,0 +1,25 @@ + +package utils + +import ( + "testing" + "github.com/stretchr/testify/assert" +) + +func TestJsonGetInt64WithString(t *testing.T) { + + n := JsonGetInt64("test") + assert.Equal(t, int64(0), n) +} + +func TestJsonGetInt64WithInt(t *testing.T) { + + n := JsonGetInt64(1234) + assert.Equal(t, int64(0), n) +} + +func TestJsonGetInt64WithFloat64(t *testing.T) { + + n := JsonGetInt64(float64(1234)) + assert.Equal(t, int64(1234), n) +}