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('0x932167388dD9aad41149b3cA23eBD489E2E2DD78')

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