bus checks

This commit is contained in:
Hardhat Chad
2024-02-16 17:51:00 +00:00
parent 992ad9d2ab
commit 3934f81b31
9 changed files with 45 additions and 50 deletions

View File

@@ -91,9 +91,8 @@ async fn test_initialize() {
let bus_account = banks.get_account(bus_pdas[i].0).await.unwrap().unwrap();
assert_eq!(bus_account.owner, ore::id());
let bus = Bus::try_from_bytes(&bus_account.data).unwrap();
// assert_eq!(bus.bump as u8, bus_pdas[i].1);
assert_eq!(bus.id as u8, i as u8);
assert_eq!(bus.available_rewards, 0);
assert_eq!(bus.rewards, 0);
println!(
"Bus {:?} {:?} {:?}",
bus_pdas[i].0,

View File

@@ -97,7 +97,7 @@ async fn setup_program_test_env() -> (BanksClient, Keypair, solana_program::hash
&(Bus::discriminator() as u64).to_le_bytes(),
Bus {
id: i as u64,
available_rewards: 250_000_000,
rewards: 250_000_000,
}
.to_bytes(),
]

View File

@@ -56,7 +56,7 @@ async fn test_reset() {
bs64::encode(&bus_account.data)
);
assert_eq!(bus.id as u8, i as u8);
assert_eq!(bus.available_rewards, BUS_EPOCH_REWARDS);
assert_eq!(bus.rewards, BUS_EPOCH_REWARDS);
}
// Test treasury state
@@ -136,7 +136,7 @@ async fn setup_program_test_env() -> (BanksClient, Keypair, Hash) {
&(Bus::discriminator() as u64).to_le_bytes(),
Bus {
id: i as u64,
available_rewards: 0,
rewards: 0,
}
.to_bytes(),
]