From 46281e6fa7549bc74ad5f9c02ea48488dec9c61e Mon Sep 17 00:00:00 2001 From: Joe Date: Thu, 31 Aug 2023 16:01:20 -0600 Subject: [PATCH] fix a lil test bug --- .../program-2022-test/tests/transfer_hook.rs | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/token/program-2022-test/tests/transfer_hook.rs b/token/program-2022-test/tests/transfer_hook.rs index 0506ca1553e..7b291db6809 100644 --- a/token/program-2022-test/tests/transfer_hook.rs +++ b/token/program-2022-test/tests/transfer_hook.rs @@ -706,10 +706,13 @@ async fn success_transfers_using_onchain_helper() { offchain::resolve_extra_transfer_account_metas( &mut instruction, |address| { - token_a - .get_account(address) - .map_ok(|acc| Some(acc.data)) - .map_err(offchain::AccountFetchError::from) + token_a.get_account(address).map_ok_or_else( + |e| match e { + TokenClientError::AccountNotFound => Ok(None), + _ => Err(offchain::AccountFetchError::from(e)), + }, + |acc| Ok(Some(acc.data)) + ) }, &mint_a, ) @@ -718,10 +721,13 @@ async fn success_transfers_using_onchain_helper() { offchain::resolve_extra_transfer_account_metas( &mut instruction, |address| { - token_a - .get_account(address) - .map_ok(|acc| Some(acc.data)) - .map_err(offchain::AccountFetchError::from) + token_a.get_account(address).map_ok_or_else( + |e| match e { + TokenClientError::AccountNotFound => Ok(None), + _ => Err(offchain::AccountFetchError::from(e)), + }, + |acc| Ok(Some(acc.data)) + ) }, &mint_b, )