From d10c524d34af9d32f660ccd0595ff7da593f4596 Mon Sep 17 00:00:00 2001 From: Ruslan Abelharisov Date: Mon, 21 Oct 2019 12:12:25 +0300 Subject: [PATCH] Replace t.fatal with testify package functions (#12842) --- web/context_test.go | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/web/context_test.go b/web/context_test.go index 3fa6ebf22d..dfd779992c 100644 --- a/web/context_test.go +++ b/web/context_test.go @@ -3,6 +3,8 @@ package web import ( "net/http" "testing" + + "github.com/stretchr/testify/require" ) func TestRequireHookId(t *testing.T) { @@ -11,21 +13,14 @@ func TestRequireHookId(t *testing.T) { c.Params = &Params{HookId: "abcdefghijklmnopqrstuvwxyz"} c.RequireHookId() - if c.Err != nil { - t.Fatal("Hook Id is Valid. Should not have set error in context") - } + require.Nil(t, c.Err, "Hook Id is Valid. Should not have set error in context") }) t.Run("WhenHookIdIsInvalid", func(t *testing.T) { c.Params = &Params{HookId: "abc"} c.RequireHookId() - if c.Err == nil { - t.Fatal("Should have set Error in context") - } - - if c.Err.StatusCode != http.StatusBadRequest { - t.Fatal("Should have set status as 400") - } + require.Error(t, c.Err, "Should have set Error in context") + require.Equal(t, http.StatusBadRequest, c.Err.StatusCode, "Should have set status as 400") }) }