2021-11-23 11:05:38 +00:00
|
|
|
package swap
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2022-05-06 19:29:31 +00:00
|
|
|
"github.com/status-im/go-waku/waku/v2/utils"
|
2021-11-23 11:05:38 +00:00
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestSwapCreditDebit(t *testing.T) {
|
2022-05-27 13:25:06 +00:00
|
|
|
swap := NewWakuSwap(utils.Logger().Sugar(), []SwapOption{
|
2021-11-23 11:05:38 +00:00
|
|
|
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"])
|
|
|
|
}
|