Skip to content

Commit

Permalink
tests: Add a test case
Browse files Browse the repository at this point in the history
  • Loading branch information
acheroncrypto committed Jan 14, 2025
1 parent 9b6b557 commit 2797df6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/pda-derivation/programs/pda-derivation/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ pub mod pda_derivation {
pub fn unsupported_program_seed(_ctx: Context<UnsupportedProgramSeed>) -> Result<()> {
Ok(())
}

pub fn call_expr_with_no_args(_ctx: Context<CallExprWithNoArgs>) -> Result<()> {
Ok(())
}
}

#[derive(Accounts)]
Expand Down Expand Up @@ -210,6 +214,16 @@ fn external_function_with_an_argument(pk: &Pubkey) -> Pubkey {
*pk
}

#[derive(Accounts)]
pub struct CallExprWithNoArgs<'info> {
#[account(
seeds = [System::id().as_ref()],
seeds::program = System::id(),
bump
)]
pub pda: UncheckedAccount<'info>,
}

#[account]
pub struct MyAccount {
data: u64,
Expand Down
4 changes: 4 additions & 0 deletions tests/pda-derivation/tests/typescript.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,8 @@ describe("typescript", () => {
// @ts-expect-error
expect(acc.pda).to.be.undefined;
});

it("Can resolve call expressions with no arguments", async () => {
await program.methods.callExprWithNoArgs().rpc();
});
});

0 comments on commit 2797df6

Please sign in to comment.