From 6b4ec6cd82bd80d119d5596f14f2647260dbc907 Mon Sep 17 00:00:00 2001 From: Ankit Kumar Date: Mon, 5 Dec 2022 16:10:39 +0530 Subject: [PATCH] test(identities): adding test for nil identityID --- modules/identities/internal/key/key_test.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/identities/internal/key/key_test.go b/modules/identities/internal/key/key_test.go index 792537c45..b3def7584 100644 --- a/modules/identities/internal/key/key_test.go +++ b/modules/identities/internal/key/key_test.go @@ -77,7 +77,9 @@ func Test_keyFromInterface(t *testing.T) { want key wantErr bool }{ - {"+ve", args{}, key{}, true}, + {"+ve", args{nil}, key{nil}, true}, + {"-ve", args{NewKey(nil)}, key{testIdentity}, false}, + {"-ve", args{testIdentity}, key{nil}, true}, {"+ve", args{NewKey(testIdentity)}, key{testIdentity}, false}, {"-ve", args{baseIds.NewStringID("StringID")}, key{}, true}, } @@ -109,6 +111,9 @@ func Test_key_Equals(t *testing.T) { args args want bool }{ + {"+ve", fields{nil}, args{key{nil}}, true}, + {"-ve", fields{nil}, args{key{testIdentity}}, false}, + {"-ve", fields{testIdentity}, args{key{nil}}, false}, {"+ve", fields{testIdentity}, args{key{testIdentity}}, true}, } for _, tt := range tests {