mirror of
https://github.com/AthanorLabs/atomic-swap.git
synced 2026-01-09 14:18:03 -05:00
32 lines
672 B
Go
32 lines
672 B
Go
// Copyright 2023 The AthanorLabs/atomic-swap Authors
|
|
// SPDX-License-Identifier: LGPL-3.0-only
|
|
|
|
package common
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestNewEnv(t *testing.T) {
|
|
expected := map[string]Environment{
|
|
"mainnet": Mainnet,
|
|
"stagenet": Stagenet,
|
|
"dev": Development,
|
|
}
|
|
|
|
for strVal, expectedResult := range expected {
|
|
env, err := NewEnv(strVal)
|
|
require.NoError(t, err)
|
|
require.Equal(t, expectedResult, env)
|
|
require.Equal(t, strVal, env.String())
|
|
require.NotNil(t, ConfigDefaultsForEnv(env))
|
|
}
|
|
}
|
|
|
|
func TestNewEnv_fail(t *testing.T) {
|
|
_, err := NewEnv("something")
|
|
require.ErrorContains(t, err, "unknown")
|
|
}
|