import {test} from 'node:test'
import assert from 'node:assert'
import {closeGmxPositionImpl, getClientForAddress} from '../../src/plugins/custom/gmx'
import {TradeDirection} from '../../src/generated/ManagingApiTypes'

test('GMX Position Closing', async (t) => {
    await t.test('should close a long position for BTC', async () => {
        const sdk = await getClientForAddress('0x0b4A132cb6ed8fa66953bf61a53D0B91DaCaAd78')

        const result = await closeGmxPositionImpl(
            sdk,
            "BTC",
            TradeDirection.Long
        )
        console.log('Position closing result:', result)
        assert.ok(result, 'Position closing result should be defined')
    })
})
