From dc933290d674edaff8ecdfaabd4f79c96f5bf9e2 Mon Sep 17 00:00:00 2001 From: Mike MacCana Date: Fri, 23 Aug 2024 12:36:47 -0400 Subject: [PATCH 1/2] Remove ugly log --- basics/favorites/anchor/tests/favorites.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/basics/favorites/anchor/tests/favorites.ts b/basics/favorites/anchor/tests/favorites.ts index 9837c3c54..a48e848e4 100644 --- a/basics/favorites/anchor/tests/favorites.ts +++ b/basics/favorites/anchor/tests/favorites.ts @@ -55,8 +55,6 @@ describe('Favorites', () => { const newFavoriteHobbies = ['skiing', 'skydiving', 'biking', 'swimming']; try { const signature = await program.methods.setFavorites(favoriteNumber, favoriteColor, newFavoriteHobbies).signers([user]).rpc(); - - console.log(`Transaction signature: ${signature}`); } catch (error) { console.error((error as Error).message); const customErrorMessage = getCustomErrorMessage(systemProgramErrors, error); From 0859912a7e1d49a1f3f7f871edd144376b169ced Mon Sep 17 00:00:00 2001 From: Mike MacCana Date: Fri, 23 Aug 2024 12:44:03 -0400 Subject: [PATCH 2/2] Fix slow warnings for favorites program tests --- basics/favorites/anchor/tests/favorites.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/basics/favorites/anchor/tests/favorites.ts b/basics/favorites/anchor/tests/favorites.ts index a48e848e4..c01c27a66 100644 --- a/basics/favorites/anchor/tests/favorites.ts +++ b/basics/favorites/anchor/tests/favorites.ts @@ -6,6 +6,8 @@ import type { Favorites } from '../target/types/favorites'; import { systemProgramErrors } from './system-errors'; const web3 = anchor.web3; +const SECONDS = 1000; + describe('Favorites', () => { // Use the cluster and the keypair from Anchor.toml const provider = anchor.AnchorProvider.env(); @@ -49,7 +51,7 @@ describe('Favorites', () => { assert.equal(dataFromPda.number.toString(), favoriteNumber.toString()); // And check the hobbies too assert.deepEqual(dataFromPda.hobbies, favoriteHobbies); - }); + }).slow(4 * SECONDS); it('Updates the favorites', async () => { const newFavoriteHobbies = ['skiing', 'skydiving', 'biking', 'swimming']; @@ -60,7 +62,7 @@ describe('Favorites', () => { const customErrorMessage = getCustomErrorMessage(systemProgramErrors, error); throw new Error(customErrorMessage); } - }); + }).slow(4 * SECONDS); it('Rejects transactions from unauthorized signers', async () => { try { @@ -75,5 +77,5 @@ describe('Favorites', () => { const errorMessage = (error as Error).message; assert.isTrue(errorMessage.includes('unknown signer')); } - }); + }).slow(4 * SECONDS); });