Skip to content

Commit 674a337

Browse files
committed
fix: tests
1 parent 771be87 commit 674a337

2 files changed

Lines changed: 6 additions & 65 deletions

File tree

program-tests/compressed-token-test/tests/transfer2/functional.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ async fn test_transfer2_functional() {
173173
test52_transfer_multiple_compressions(),
174174
test53_transfer_multiple_decompressions(),
175175
test54_transfer_compress_decompress_balanced(),
176-
test55_compress_and_close_as_owner(),
177176
test55_compress_and_close_as_owner_compressible(),
178177
test56_compress_and_close_with_destination(),
179178
test57_multiple_compress_and_close(),
@@ -2182,21 +2181,6 @@ fn test72_multiple_pools_same_mint() -> TestCase {
21822181
// CompressAndClose Operation Tests (55-60)
21832182
// ============================================================================
21842183

2185-
// Test 55: CompressAndClose as owner (not compressible)
2186-
fn test55_compress_and_close_as_owner() -> TestCase {
2187-
TestCase {
2188-
name: "CompressAndClose as owner (no validation needed)".to_string(),
2189-
actions: vec![MetaTransfer2InstructionType::CompressAndClose(
2190-
MetaCompressAndCloseInput {
2191-
token_data_version: TokenDataVersion::ShaFlat, // Must be ShaFlat for security
2192-
signer_index: 0, // Owner who signs and owns the CToken ATA
2193-
destination_index: None, // No destination = authority receives rent
2194-
mint_index: 0, // Use first mint
2195-
is_compressible: false, // Regular CToken ATA, no extensions
2196-
},
2197-
)],
2198-
}
2199-
}
22002184
// Test 55: CompressAndClose as owner (compressible)
22012185
fn test55_compress_and_close_as_owner_compressible() -> TestCase {
22022186
TestCase {

program-tests/compressed-token-test/tests/transfer2/spl_ctoken.rs

Lines changed: 6 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use light_compressed_token_sdk::{
1616
ValidityProof,
1717
};
1818
use light_ctoken_types::instructions::transfer2::{Compression, MultiTokenTransferOutputData};
19+
use light_program_test::utils::assert::assert_rpc_error;
1920
pub use light_program_test::{LightProgramTest, ProgramTestConfig};
2021
pub use light_test_utils::{
2122
airdrop_lamports,
@@ -205,7 +206,7 @@ async fn test_spl_to_ctoken_transfer() {
205206
}
206207

207208
#[tokio::test]
208-
async fn test_ctoken_to_spl_with_compress_and_close() {
209+
async fn test_failing_ctoken_to_spl_with_compress_and_close() {
209210
let mut rpc = LightProgramTest::new(ProgramTestConfig::new(true, None))
210211
.await
211212
.unwrap();
@@ -312,54 +313,10 @@ async fn test_ctoken_to_spl_with_compress_and_close() {
312313
.unwrap();
313314

314315
// Execute transaction
315-
rpc.create_and_send_transaction(&[transfer_ix], &payer.pubkey(), &[&payer, &recipient])
316-
.await
317-
.unwrap();
318-
319-
// Verify final balances
320-
{
321-
// Verify SPL token balance is restored
322-
let spl_account_data = rpc
323-
.get_account(spl_token_account_keypair.pubkey())
324-
.await
325-
.unwrap()
326-
.unwrap();
327-
let spl_account = spl_pod::bytemuck::pod_from_bytes::<PodAccount>(&spl_account_data.data)
328-
.map_err(|e| {
329-
RpcError::AssertRpcError(format!("Failed to parse SPL token account: {}", e))
330-
})
331-
.unwrap();
332-
let restored_spl_balance: u64 = spl_account.amount.into();
333-
assert_eq!(
334-
restored_spl_balance, amount,
335-
"SPL token balance should be restored to original amount"
336-
);
337-
}
338-
339-
{
340-
// Verify CToken account is CLOSED (not just balance = 0)
341-
let ctoken_account_result = rpc.get_account(associated_token_account).await.unwrap();
342-
match ctoken_account_result {
343-
None => {
344-
println!("✓ CToken account successfully closed (account does not exist)");
345-
}
346-
Some(account_data) => {
347-
assert_eq!(
348-
account_data.data.len(),
349-
0,
350-
"CToken account data should be empty after CompressAndClose"
351-
);
352-
assert_eq!(
353-
account_data.lamports, 0,
354-
"CToken account lamports should be 0 after CompressAndClose"
355-
);
356-
println!("✓ CToken account successfully closed (zeroed out)");
357-
}
358-
}
359-
}
360-
361-
println!("✓ Successfully completed CToken -> SPL transfer with CompressAndClose");
362-
println!(" This validates owner can use CompressAndClose without explicit compressed_token_account validation");
316+
let result = rpc
317+
.create_and_send_transaction(&[transfer_ix], &payer.pubkey(), &[&payer, &recipient])
318+
.await;
319+
assert_rpc_error(result, 0, 3).unwrap();
363320
}
364321

365322
pub struct CtokenToSplTransferAndClose {

0 commit comments

Comments
 (0)