Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit tests for decreaseLiquidity.ts #545

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

calintje
Copy link
Contributor

Title
Added unit tests for decreaseLiquidity.ts

Details

  • Updated setupPosition and setupTEPosition to support increased liquidity
  • Added unit tests for decreaseLiquidity.ts
    • decreaseLiquidity.test.ts
    • closePosition.test.ts


for (const poolName of poolTypes.keys()) {
it(`Should close the position for ${poolName}`, async () => {
await testClosePositionInstructions(poolName);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TE Position?

await assert.rejects(
decreaseLiquidityInstructions(
rpc,
positions.entries().next().value,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Maybe hard-code the key here so it is clear which position it is getting

const position = await setupPosition(poolAddress, {
tickLower: -100,
tickUpper: 100,
liquidity,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One test to close a postion without liquidity?

await sendTransaction(instructions);

const positionAfter = await fetchMaybePosition(rpc, positionAddress[0]);
assert.strictEqual(positionAfter.exists, false);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also check if fees/rewards are harvested correctly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants