Skip to content

Commit

Permalink
Fix unit test for verification details
Browse files Browse the repository at this point in the history
  • Loading branch information
Hungry Warrior committed May 29, 2024
1 parent a4370d0 commit 8139d28
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions x/evm/keeper/sgxvm_connector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ func (suite *KeeperTestSuite) TestSingleVerificationDetails() {
_ = suite.app.ComplianceKeeper.SetAddressVerificationStatus(suite.ctx, issuerAccount, true)

expectedVerificationDetails = &types.VerificationDetails{
VerificationType: uint32(verificationType),
IssuerAddress: issuerAccount.Bytes(),
OriginChain: "samplechain",
IssuanceTimestamp: uint32(suite.ctx.BlockTime().Unix()),
Expand Down Expand Up @@ -467,6 +468,7 @@ func (suite *KeeperTestSuite) TestSingleVerificationDetails() {
suite.Require().NoError(decodeErr)

suite.Require().Equal(1, len(resp.Data))
expectedVerificationDetails.VerificationID = verificationID
suite.Require().Equal(expectedVerificationDetails, resp.Data[0])

// Should be empty for illegal issuer account
Expand Down Expand Up @@ -544,6 +546,7 @@ func (suite *KeeperTestSuite) TestMultipleVerificationDetails() {
for i := 0; i < numOfRetry; i++ {
// Addresses before making Query request should be Ethereum Addresses
verificationDetails := &types.VerificationDetails{
VerificationType: uint32(verificationType),
IssuerAddress: issuerAddress.Bytes(),
OriginChain: "samplechain",
IssuanceTimestamp: uint32(suite.ctx.BlockTime().Unix()),
Expand All @@ -553,8 +556,6 @@ func (suite *KeeperTestSuite) TestMultipleVerificationDetails() {
IssuerVerificationId: "HelloIssuer",
Version: uint32(0),
}
expected = append(expected, verificationDetails)

verificationID, err := requestAddVerificationDetails(
&connector,
userAddress,
Expand All @@ -568,6 +569,8 @@ func (suite *KeeperTestSuite) TestMultipleVerificationDetails() {
verificationDetails.IssuerVerificationId,
0,
)
verificationDetails.VerificationID = verificationID
expected = append(expected, verificationDetails)
suite.Require().NoError(err)
suite.Require().NotNil(verificationID)
}
Expand All @@ -590,6 +593,8 @@ func (suite *KeeperTestSuite) TestMultipleVerificationDetails() {
suite.Require().NoError(decodeErr)
suite.Require().Equal(numOfRetry, len(resp.Data))
for i, details := range resp.Data {
suite.Require().Equal(expected[i].VerificationType, details.VerificationType)
suite.Require().Equal(expected[i].VerificationID, details.VerificationID)
suite.Require().Equal(expected[i].IssuerAddress, details.IssuerAddress)
suite.Require().Equal(expected[i].OriginChain, details.OriginChain)
suite.Require().Equal(expected[i].IssuanceTimestamp, details.IssuanceTimestamp)
Expand Down

0 comments on commit 8139d28

Please sign in to comment.