mirror of https://github.com/status-im/go-waku.git
22 lines
399 B
Go
22 lines
399 B
Go
package swap
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/status-im/go-waku/waku/v2/utils"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestSwapCreditDebit(t *testing.T) {
|
|
swap := NewWakuSwap(utils.Logger(), []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"])
|
|
}
|