-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
blade
committed
May 22, 2024
1 parent
214d195
commit c8e16a4
Showing
2 changed files
with
109 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
package apps_registry | ||
|
||
import ( | ||
"github.com/pokt-network/gateway-server/internal/apps_registry/models" | ||
pokt_models "github.com/pokt-network/gateway-server/pkg/pokt/pokt_v0/models" | ||
"testing" | ||
) | ||
|
||
func Test_arePoktApplicationSignersEqual(t *testing.T) { | ||
type args struct { | ||
slice1 []*models.PoktApplicationSigner | ||
slice2 []*models.PoktApplicationSigner | ||
} | ||
tests := []struct { | ||
name string | ||
args args | ||
want bool | ||
}{ | ||
{ | ||
name: "different length", | ||
args: args{ | ||
slice1: []*models.PoktApplicationSigner{}, | ||
slice2: []*models.PoktApplicationSigner{{NetworkApp: &pokt_models.PoktApplication{ | ||
Address: "123", | ||
Chains: []string{"123", "123"}, | ||
PublicKey: "", | ||
Status: 0, | ||
MaxRelays: 0, | ||
}}}, | ||
}, | ||
want: false, | ||
}, | ||
{ | ||
name: "different address", | ||
args: args{ | ||
slice1: []*models.PoktApplicationSigner{{NetworkApp: &pokt_models.PoktApplication{ | ||
Address: "1234", | ||
Chains: []string{"123", "123"}, | ||
PublicKey: "", | ||
Status: 0, | ||
MaxRelays: 0, | ||
}}}, | ||
slice2: []*models.PoktApplicationSigner{{NetworkApp: &pokt_models.PoktApplication{ | ||
Address: "123", | ||
Chains: []string{"123", "123"}, | ||
PublicKey: "", | ||
Status: 0, | ||
MaxRelays: 0, | ||
}}}, | ||
}, | ||
want: false, | ||
}, | ||
{ | ||
name: "different chains", | ||
args: args{ | ||
slice1: []*models.PoktApplicationSigner{{NetworkApp: &pokt_models.PoktApplication{ | ||
Address: "1234", | ||
Chains: []string{"123", "123"}, | ||
PublicKey: "", | ||
Status: 0, | ||
MaxRelays: 0, | ||
}}}, | ||
slice2: []*models.PoktApplicationSigner{{NetworkApp: &pokt_models.PoktApplication{ | ||
Address: "123", | ||
Chains: []string{"123"}, | ||
PublicKey: "", | ||
Status: 0, | ||
MaxRelays: 0, | ||
}}}, | ||
}, | ||
want: false, | ||
}, | ||
{ | ||
name: "same apps", | ||
args: args{ | ||
slice1: []*models.PoktApplicationSigner{{NetworkApp: &pokt_models.PoktApplication{ | ||
Address: "123", | ||
Chains: []string{"123", "123"}, | ||
PublicKey: "", | ||
Status: 0, | ||
MaxRelays: 0, | ||
}}}, | ||
slice2: []*models.PoktApplicationSigner{{NetworkApp: &pokt_models.PoktApplication{ | ||
Address: "123", | ||
Chains: []string{"123", "123"}, | ||
PublicKey: "", | ||
Status: 0, | ||
MaxRelays: 0, | ||
}}}, | ||
}, | ||
want: true, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
if got := arePoktApplicationSignersEqual(tt.args.slice1, tt.args.slice2); got != tt.want { | ||
t.Errorf("arePoktApplicationSignersEqual() = %v, want %v", got, tt.want) | ||
} | ||
}) | ||
} | ||
} |