go-waku/waku/v2/protocol/swap/waku_swap_test.go
Anthony Laibe 3571f0bab9 feat: init swap protocol
* Add proto files
* Add options
* Add credit/debit for soft mode
2021-11-24 13:58:35 +01:00

21 lines
337 B
Go

package swap
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestSwapCreditDebit(t *testing.T) {
swap := NewWakuSwap([]SwapOption{
WithMode(SoftMode),
WithThreshold(0, 0),
}...)
swap.Credit("1", 1)
require.Equal(t, -1, swap.Accounting["1"])
swap.Debit("1", 2)
require.Equal(t, 1, swap.Accounting["1"])
}