import {test} from 'node:test'
import assert from 'node:assert'
import {closeGmxPositionImpl, getClientForAddress} from '../../src/plugins/custom/gmx'
import {Ticker, 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('0xbBA4eaA534cbD0EcAed5E2fD6036Aec2E7eE309f')

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