add test for types.ExchangeName

This commit is contained in:
zenix.huang 2024-03-12 16:09:46 +09:00
parent 465e7d8983
commit d4eef3e3f9

View File

@ -0,0 +1,17 @@
package types
import (
"testing"
"github.com/stretchr/testify/assert"
)
func Test_exchangeName(t *testing.T) {
assert.Equal(t, ExchangeMax.String(), "max")
name, err := ValidExchangeName("binance")
assert.Equal(t, name, ExchangeName("binance"))
assert.NoError(t, err)
_, err = ValidExchangeName("dummy")
assert.Error(t, err)
assert.True(t, ExchangeMax.IsValid())
}