Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Commit

Permalink
TestMarketID, closes #594
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhilsaraf committed Nov 24, 2020
1 parent b5d81e6 commit 7c55c13
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions plugins/fillDBWriter_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package plugins

import (
"fmt"
"testing"

"github.com/stretchr/testify/assert"
)

func TestMarketID(t *testing.T) {
testCases := []struct {
exchangeName string
baseAsset string
quoteAsset string
wantMarketID string
}{
{
exchangeName: "kraken",
baseAsset: "XLM",
quoteAsset: "USD",
wantMarketID: "96eda0a6ec",
}, {
exchangeName: "kraken",
baseAsset: "XLM",
quoteAsset: "BTC",
wantMarketID: "02bee86ba8",
}, {
exchangeName: "ccxt-kraken",
baseAsset: "XLM",
quoteAsset: "USD",
wantMarketID: "8eb89f0940",
}, {
exchangeName: "ccxt-binance",
baseAsset: "XLM",
quoteAsset: "USDT",
wantMarketID: "fadc072837",
}, {
exchangeName: "ccxt-coinbasepro",
baseAsset: "XLM",
quoteAsset: "USD",
wantMarketID: "43b2018ed3",
}, {
exchangeName: "ccxt-poloniex",
baseAsset: "XLM",
quoteAsset: "USD",
wantMarketID: "f908f42d25",
}, {
exchangeName: "ccxt-bitstamp",
baseAsset: "XLM",
quoteAsset: "USD",
wantMarketID: "d438b87fff",
},
}

for _, k := range testCases {
t.Run(fmt.Sprintf("%s_%s_%s", k.exchangeName, k.baseAsset, k.quoteAsset), func(t *testing.T) {
marketID := MakeMarketID(k.exchangeName, k.baseAsset, k.quoteAsset)

assert.Equal(t, k.wantMarketID, marketID)
})
}
}

0 comments on commit 7c55c13

Please sign in to comment.