From 9efaef650d60340e4e5f45ed1f2b847b64c616c4 Mon Sep 17 00:00:00 2001 From: mo khan Date: Sun, 15 May 2022 21:03:49 -0600 Subject: test: start to add tests for inserting a new client --- pkg/x/must_test.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 pkg/x/must_test.go (limited to 'pkg/x/must_test.go') diff --git a/pkg/x/must_test.go b/pkg/x/must_test.go new file mode 100644 index 0000000..a571beb --- /dev/null +++ b/pkg/x/must_test.go @@ -0,0 +1,24 @@ +package x + +import ( + "errors" + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestMust(t *testing.T) { + t.Run("without error", func(t *testing.T) { + item := 1 + result := Must(item, nil) + assert.Equal(t, item, result) + }) + + t.Run("with error", func(t *testing.T) { + assert.Panics(t, func() { + item := 1 + result := Must(item, errors.New("darn")) + assert.Equal(t, item, result) + }) + }) +} -- cgit v1.2.3