You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I start with service/network package and will do research about service/network/networkchain in the separate issue
Suggestions
Rename the Network object. A network is a widely used term in computer since in the case of starport Network stands for object which is used for interacting with SPN. It could be NetworkClient since it sends requests to SPN but it also modifies files on the computer and do some other things. So I would designate this object as a Service object for interaction with starport network shortened it to StarportNetworkService or SPNService. The alternative version is NetworkService assuming that this code already exists in the starport domain and if the network title was not specified explicitly it means it is the starport network. Wdyt?
Many methods rely upon launchtypes.NewQueryClient it returns new instance of a network client which is performing a request sending.
I don't see a reason for creating a new queryClient every time performing a query to the network. For example here, here and here or even here (two clients created within one method). Query client(s) could just be initialised in the network constructor As I see they reuse the same connection from Network.cosmos. Code organised this way will be easy to test.
Network Methods:
Join
sendAccountRequest Mock network.account. Create temp dir and write genesis file there, provide path to the method. hasAccount behaviour is defined via mocked queryClient.GenesisAccount.
sendValidatorRequest mock cosmos.BroadcastTx and queryClient.GenesisValidator
hasValidator mock queryClient.GenesisValidator and try different results
hasAccount mock queryClient.GenesisAccount and queryClient.VestingAccount and try different results
LaunchParams mock queryClient.Params and try different return results
TriggerLaunch mock queryClient.Params and try different params. Mock cosmos.BroadcastTx and try failed broadcast and invalid response scenarios
Publish chain methods can be mocked. queryClients for campaign, profile and launch can be mocked. A lot of cases for tests in this method.
ChainLaunch mock queryClient.Chain and try different results
ChainLaunches mock queryClient.ChainAll and try different results
GenesisInformation results of GenesisAccounts , VestingAccounts and GenesisValidators depend on mocked queryClient
VestingAccounts mock queryClient.VestingAccountAll and try different results and an invalid validator
GenesisValidators mock queryClient.GenesisValidatorAll and try different results
GenesisAccounts mock queryClient.GenesisAccountsAll and try different results
Requests mock queryClient.RequestAll and try different results ( i would suggest moving this function to queries.go)
Request mock queryClient.Request and try different results( i would suggest moving this function to queries.go)
SubmitRequest mock cosmos.BroadcastTx and try failed broadcast and invalid response scenarios
VerifyRequests mock queryClient.Request and try different types of invalid requests
No description provided.
The text was updated successfully, but these errors were encountered: