From 0d7dd11ad4f157f3112c8a3d75d58edcfc3f2af2 Mon Sep 17 00:00:00 2001 From: Maina Wycliffe Date: Tue, 11 Feb 2020 22:42:59 +0300 Subject: [PATCH] test: add test for creating customer firebase error --- firebase/error_test.go | 44 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 firebase/error_test.go diff --git a/firebase/error_test.go b/firebase/error_test.go new file mode 100644 index 0000000..d8a9939 --- /dev/null +++ b/firebase/error_test.go @@ -0,0 +1,44 @@ +package firebase + +import ( + "errors" + "fmt" + "testing" +) + +func TestNewError(t *testing.T) { + type args struct { + err error + } + tests := []struct { + name string + args args + want FirebaseError + }{ + { + "Test Error 1", + args{ + err: fmt.Errorf("ERROR"), + }, + FirebaseError{ + FirebaseError: fmt.Errorf("ERROR"), + }, + }, + { + "Test Error 2", + args{ + err: errors.New("ERROR"), + }, + FirebaseError{ + FirebaseError: errors.New("ERROR"), + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if got := NewError(tt.args.err); got.Error() != tt.want.Error() { + t.Errorf("NewError() = %v, want %v", got, tt.want) + } + }) + } +}