erigon-pulse/cmd/devnet/models/model_test.go
Leonard Chinonso 9d172ae125
Devnet Remake (#5532)
* Rebuilding the devnet tool for better quality

* Added README

* deleted former devnettest folder

* Correction changes

* Implementation node connection through enode for two nodes

* synced two nodes, moving to logging

* Fixed lint
2022-09-30 21:04:34 +01:00

33 lines
822 B
Go

package models
import (
"fmt"
"testing"
)
func TestParameterFromArgument(t *testing.T) {
enode := fmt.Sprintf("%q", "1234567")
testCases := []struct {
argInput string
paramInput string
expectedRes string
expectedErr error
}{
{"--datadir", "./dev", "--datadir=./dev", nil},
{"--chain", "dev", "--chain=dev", nil},
{"--dev.period", "30", "--dev.period=30", nil},
{"--staticpeers", enode, "--staticpeers=" + enode, nil},
{"", "30", "", ErrInvalidArgument},
}
for _, testCase := range testCases {
got, err := ParameterFromArgument(testCase.argInput, testCase.paramInput)
if got != testCase.expectedRes {
t.Errorf("expected %s, got %s", testCase.expectedRes, got)
}
if err != testCase.expectedErr {
t.Errorf("expected error: %s, got error: %s", testCase.expectedErr, err)
}
}
}