github.com/fibonacci-chain/fbc@v0.0.0-20231124064014-c7636198c1e9/libs/cosmos-sdk/x/genutil/legacy/v0_36/migrate_test.go (about)

     1  package v036
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/require"
     7  
     8  	"github.com/fibonacci-chain/fbc/libs/cosmos-sdk/x/genutil"
     9  )
    10  
    11  var basic034Gov = []byte(`
    12      {
    13        "starting_proposal_id": "2",
    14        "deposits": [
    15          {
    16            "proposal_id": "1",
    17            "deposit": {
    18              "depositor": "cosmos1grgelyng2v6v3t8z87wu3sxgt9m5s03xvslewd",
    19              "proposal_id": "1",
    20              "amount": [
    21                {
    22                  "denom": "uatom",
    23                  "amount": "512000000"
    24                }
    25              ]
    26            }
    27          }
    28        ],
    29        "votes" : [
    30          {
    31            "proposal_id": "1",
    32            "vote": {
    33              "voter": "cosmos1lktjhnzkpkz3ehrg8psvmwhafg56kfss5597tg",
    34              "proposal_id": "1",
    35              "option": "Yes"
    36            }
    37          }
    38        ],
    39        "proposals": [
    40          {
    41            "proposal_content": {
    42              "type": "gov/TextProposal",
    43              "value": {
    44                "title": "test",
    45                "description": "test"
    46              }
    47            },
    48            "proposal_id": "1",
    49            "proposal_status": "Passed",
    50            "final_tally_result": {
    51              "yes": "1",
    52              "abstain": "0",
    53              "no": "0",
    54              "no_with_veto": "0"
    55            },
    56            "submit_time": "2019-05-03T21:08:25.443199036Z",
    57            "deposit_end_time": "2019-05-17T21:08:25.443199036Z",
    58            "total_deposit": [
    59              {
    60                "denom": "uatom",
    61                "amount": "512000000"
    62              }
    63            ],
    64            "voting_start_time": "2019-05-04T16:02:33.24680295Z",
    65            "voting_end_time": "2019-05-18T16:02:33.24680295Z"
    66          }
    67        ],
    68        "deposit_params": {
    69          "min_deposit": [
    70            {
    71              "denom": "uatom",
    72              "amount": "512000000"
    73            }
    74          ],
    75          "max_deposit_period": "1209600000000000"
    76        },
    77        "voting_params": {
    78          "voting_period": "1209600000000000"
    79        },
    80        "tally_params": {
    81          "quorum": "0.400000000000000000",
    82          "threshold": "0.500000000000000000",
    83          "veto": "0.334000000000000000"
    84        }
    85      }
    86  `)
    87  
    88  func TestDummyGenesis(t *testing.T) {
    89  	genesisDummy := genutil.AppMap{
    90  		"foo": {},
    91  		"bar": []byte(`{"custom": "module"}`),
    92  	}
    93  	migratedDummy := Migrate(genesisDummy)
    94  
    95  	// We should not touch custom modules in the map
    96  	require.Equal(t, genesisDummy["foo"], migratedDummy["foo"])
    97  	require.Equal(t, genesisDummy["bar"], migratedDummy["bar"])
    98  }
    99  
   100  func TestGovGenesis(t *testing.T) {
   101  	genesis := genutil.AppMap{
   102  		"gov": basic034Gov,
   103  	}
   104  
   105  	require.NotPanics(t, func() { Migrate(genesis) })
   106  }