mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 04:47:18 +00:00
b114247836
* Move common gateway registration code to new package * no shared inside of beaconchain * beacon gateway Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com> Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
37 lines
1.2 KiB
Go
37 lines
1.2 KiB
Go
package gateway
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
|
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
|
)
|
|
|
|
func TestDefaultConfig(t *testing.T) {
|
|
t.Run("Without debug endpoints", func(t *testing.T) {
|
|
cfg := DefaultConfig(false)
|
|
assert.NotNil(t, cfg.Handler)
|
|
assert.NotNil(t, cfg.V1PbMux.Mux)
|
|
require.Equal(t, 1, len(cfg.V1PbMux.Patterns))
|
|
assert.Equal(t, "/eth/v1/", cfg.V1PbMux.Patterns[0])
|
|
assert.Equal(t, 4, len(cfg.V1PbMux.Registrations))
|
|
assert.NotNil(t, cfg.V1Alpha1PbMux.Mux)
|
|
require.Equal(t, 1, len(cfg.V1Alpha1PbMux.Patterns))
|
|
assert.Equal(t, "/eth/v1alpha1/", cfg.V1Alpha1PbMux.Patterns[0])
|
|
assert.Equal(t, 4, len(cfg.V1Alpha1PbMux.Registrations))
|
|
})
|
|
|
|
t.Run("With debug endpoints", func(t *testing.T) {
|
|
cfg := DefaultConfig(true)
|
|
assert.NotNil(t, cfg.Handler)
|
|
assert.NotNil(t, cfg.V1PbMux.Mux)
|
|
require.Equal(t, 1, len(cfg.V1PbMux.Patterns))
|
|
assert.Equal(t, "/eth/v1/", cfg.V1PbMux.Patterns[0])
|
|
assert.Equal(t, 5, len(cfg.V1PbMux.Registrations))
|
|
assert.NotNil(t, cfg.V1Alpha1PbMux.Mux)
|
|
require.Equal(t, 1, len(cfg.V1Alpha1PbMux.Patterns))
|
|
assert.Equal(t, "/eth/v1alpha1/", cfg.V1Alpha1PbMux.Patterns[0])
|
|
assert.Equal(t, 5, len(cfg.V1Alpha1PbMux.Registrations))
|
|
})
|
|
}
|