github.com/prysmaticlabs/prysm@v1.4.4/shared/cmd/config_test.go (about)

     1  package cmd
     2  
     3  import (
     4  	"flag"
     5  	"testing"
     6  
     7  	"github.com/prysmaticlabs/prysm/shared/params"
     8  	"github.com/prysmaticlabs/prysm/shared/testutil/assert"
     9  	"github.com/urfave/cli/v2"
    10  )
    11  
    12  func TestOverrideConfig(t *testing.T) {
    13  	cfg := &Flags{
    14  		MinimalConfig: true,
    15  	}
    16  	reset := InitWithReset(cfg)
    17  	defer reset()
    18  	c := Get()
    19  	assert.Equal(t, true, c.MinimalConfig)
    20  }
    21  
    22  func TestDefaultConfig(t *testing.T) {
    23  	cfg := &Flags{
    24  		MaxRPCPageSize: params.BeaconConfig().DefaultPageSize,
    25  	}
    26  	c := Get()
    27  	assert.DeepEqual(t, c, cfg)
    28  
    29  	reset := InitWithReset(cfg)
    30  	defer reset()
    31  	c = Get()
    32  	assert.DeepEqual(t, c, cfg)
    33  }
    34  
    35  func TestConfigureBeaconConfig(t *testing.T) {
    36  	app := cli.App{}
    37  	set := flag.NewFlagSet("test", 0)
    38  	set.Bool(MinimalConfigFlag.Name, true, "test")
    39  	context := cli.NewContext(&app, set, nil)
    40  	ConfigureBeaconChain(context)
    41  	c := Get()
    42  	assert.Equal(t, true, c.MinimalConfig)
    43  }