2021-11-23 11:05:38 +00:00
|
|
|
package swap
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2022-01-18 18:17:06 +00:00
|
|
|
"github.com/status-im/go-waku/tests"
|
2021-11-23 11:05:38 +00:00
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestSwapCreditDebit(t *testing.T) {
|
2022-01-18 18:17:06 +00:00
|
|
|
swap := NewWakuSwap(tests.Logger(), []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"])
|
|
|
|
}
|