From 2b3e4e08b84d8caff0fedc68992a19788cb09605 Mon Sep 17 00:00:00 2001 From: Matthew Dinh Date: Tue, 20 Aug 2024 23:43:35 +0700 Subject: [PATCH] Update tests --- tests/v2/locker.ts | 9 +++++---- tests/v2/unsupported_mint.ts | 7 ++++--- tests/v2/update_recipient.ts | 35 ++++++++++++++++++++--------------- 3 files changed, 29 insertions(+), 22 deletions(-) diff --git a/tests/v2/locker.ts b/tests/v2/locker.ts index ce4f5b3..907bab3 100644 --- a/tests/v2/locker.ts +++ b/tests/v2/locker.ts @@ -65,14 +65,15 @@ describe("[V2] Test full flow", () => { program.provider.connection ); - const startTime = new BN(currentBlockTime).add(new BN(5)); + const cliffTime = new BN(currentBlockTime).add(new BN(5)); let escrow = await createVestingPlan({ ownerKeypair: UserKP, + vestingStartTime: new BN(0), tokenMint: TOKEN, isAssertion: true, - startTime, + cliffTime, frequency: new BN(1), - initialUnlockAmount: new BN(100_000), + cliffUnlockAmount: new BN(100_000), amountPerPeriod: new BN(50_000), numberOfPeriod: new BN(2), recipient: RecipientKP.publicKey, @@ -84,7 +85,7 @@ describe("[V2] Test full flow", () => { const currentBlockTime = await getCurrentBlockTime( program.provider.connection ); - if (currentBlockTime > startTime.toNumber()) { + if (currentBlockTime > cliffTime.toNumber()) { break; } else { await sleep(1000); diff --git a/tests/v2/unsupported_mint.ts b/tests/v2/unsupported_mint.ts index 01a5526..a3aa099 100644 --- a/tests/v2/unsupported_mint.ts +++ b/tests/v2/unsupported_mint.ts @@ -128,15 +128,16 @@ describe("[V2] Test supported/unsupported Token Mint", () => { program.provider.connection ); - const startTime = new BN(currentBlockTime).add(new BN(5)); + const cliffTime = new BN(currentBlockTime).add(new BN(5)); try { await createVestingPlan({ ownerKeypair: UserKP, + vestingStartTime: new BN(0), tokenMint: TOKEN, isAssertion: true, - startTime, + cliffTime, frequency: new BN(1), - initialUnlockAmount: new BN(100_000), + cliffUnlockAmount: new BN(100_000), amountPerPeriod: new BN(50_000), numberOfPeriod: new BN(2), recipient: RecipientKP.publicKey, diff --git a/tests/v2/update_recipient.ts b/tests/v2/update_recipient.ts index 3660843..3fae4b4 100644 --- a/tests/v2/update_recipient.ts +++ b/tests/v2/update_recipient.ts @@ -144,14 +144,15 @@ describe("[V2] Update recipient", () => { program.provider.connection ); - const startTime = new BN(currentBlockTime).add(new BN(5)); + const cliffTime = new BN(currentBlockTime).add(new BN(5)); let escrow = await createVestingPlan({ ownerKeypair: UserKP, + vestingStartTime: new BN(0), tokenMint: TOKEN, isAssertion: true, - startTime, + cliffTime, frequency: new BN(1), - initialUnlockAmount: new BN(100_000), + cliffUnlockAmount: new BN(100_000), amountPerPeriod: new BN(50_000), numberOfPeriod: new BN(2), recipient: RecipientKP.publicKey, @@ -196,14 +197,15 @@ describe("[V2] Update recipient", () => { program.provider.connection ); - const startTime = new BN(currentBlockTime).add(new BN(5)); + const cliffTime = new BN(currentBlockTime).add(new BN(5)); let escrow = await createVestingPlan({ ownerKeypair: UserKP, + vestingStartTime: new BN(0), tokenMint: TOKEN, isAssertion: true, - startTime, + cliffTime, frequency: new BN(1), - initialUnlockAmount: new BN(100_000), + cliffUnlockAmount: new BN(100_000), amountPerPeriod: new BN(50_000), numberOfPeriod: new BN(2), recipient: RecipientKP.publicKey, @@ -242,14 +244,15 @@ describe("[V2] Update recipient", () => { program.provider.connection ); - const startTime = new BN(currentBlockTime).add(new BN(5)); + const cliffTime = new BN(currentBlockTime).add(new BN(5)); let escrow = await createVestingPlan({ ownerKeypair: UserKP, + vestingStartTime: new BN(0), tokenMint: TOKEN, isAssertion: true, - startTime, + cliffTime, frequency: new BN(1), - initialUnlockAmount: new BN(100_000), + cliffUnlockAmount: new BN(100_000), amountPerPeriod: new BN(50_000), numberOfPeriod: new BN(2), recipient: RecipientKP.publicKey, @@ -288,14 +291,15 @@ describe("[V2] Update recipient", () => { program.provider.connection ); - const startTime = new BN(currentBlockTime).add(new BN(5)); + const cliffTime = new BN(currentBlockTime).add(new BN(5)); let escrow = await createVestingPlan({ ownerKeypair: UserKP, + vestingStartTime: new BN(0), tokenMint: TOKEN, isAssertion: true, - startTime, + cliffTime, frequency: new BN(1), - initialUnlockAmount: new BN(100_000), + cliffUnlockAmount: new BN(100_000), amountPerPeriod: new BN(50_000), numberOfPeriod: new BN(2), recipient: RecipientKP.publicKey, @@ -327,14 +331,15 @@ describe("[V2] Update recipient", () => { program.provider.connection ); - const startTime = new BN(currentBlockTime).add(new BN(5)); + const cliffTime = new BN(currentBlockTime).add(new BN(5)); let escrow = await createVestingPlan({ ownerKeypair: UserKP, + vestingStartTime: new BN(0), tokenMint: TOKEN, isAssertion: true, - startTime, + cliffTime, frequency: new BN(1), - initialUnlockAmount: new BN(100_000), + cliffUnlockAmount: new BN(100_000), amountPerPeriod: new BN(50_000), numberOfPeriod: new BN(2), recipient: RecipientKP.publicKey,