From 131345a762b2ff1c98bbb248cf690914e0c26b67 Mon Sep 17 00:00:00 2001 From: c9s Date: Wed, 28 Jun 2023 18:13:11 +0800 Subject: [PATCH] types: add TestPosition_SetClosing test --- pkg/types/position_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pkg/types/position_test.go b/pkg/types/position_test.go index 0b9b98320..6e7b6c747 100644 --- a/pkg/types/position_test.go +++ b/pkg/types/position_test.go @@ -313,3 +313,15 @@ func TestPosition(t *testing.T) { }) } } + +func TestPosition_SetClosing(t *testing.T) { + p := NewPosition("BTCUSDT", "BTC", "USDT") + ret := p.SetClosing(true) + assert.True(t, ret) + + ret = p.SetClosing(true) + assert.False(t, ret) + + ret = p.SetClosing(false) + assert.True(t, ret) +}