Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ncoquelet committed Jul 21, 2024
1 parent 66194e2 commit 0d6864e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/programs/solidr-program/client/SolidrClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ export class SolidrClient extends AbstractSolanaClient<Solidr> {
});
}

public async updateExpense(member: Wallet, sessionId: BN, expenseId: BN, name: string, amount: number, participants?: PublicKey[]): Promise<ITransactionResult> {
public async updateExpense(member: Wallet, sessionId: BN, expenseId: BN, name: string, amount: number, participants: PublicKey[]): Promise<ITransactionResult> {
return this.wrapFn(async () => {
const sessionAccountPubkey = this.findSessionAccountAddress(sessionId);
const memberAccountPubkey = this.findSessionMemberAccountAddress(sessionId, member.publicKey);
Expand Down
9 changes: 4 additions & 5 deletions packages/programs/solidr-program/tests/solidr.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ describe('solidr', () => {
});
});

describe('> updateExpense', () => {
describe.only('> updateExpense', () => {
let currentExpenseId: BN;
let currentExpenseAccountPubkey: PublicKey;

Expand Down Expand Up @@ -630,16 +630,15 @@ describe('solidr', () => {
});

it('> should fail when called with non owner of expense', async () => {
await assertError(async () => client.updateExpense(bob, sessionId, currentExpenseId, 'exp 3 updated', 100), {
await assertError(async () => client.updateExpense(bob, sessionId, currentExpenseId, 'exp 3 updated', 100, [bob.publicKey]), {
code: 'NotExpenseOwner',
message: 'Only expense owner can update or delete expense',
});
});

it('> should fail when called with invalid session id', async () => {
await assertError(async () => client.updateExpense(alice, new BN(666), currentExpenseId, 'exp 3 updated', 100), {
code: 'AccountNotInitialized',
message: 'The program expected this account to be already initialized',
await assertError(async () => client.updateExpense(alice, new BN(666), currentExpenseId, 'exp 3 updated', 100, [bob.publicKey]), {
message: ACCOUNT_NOT_FOUND,
});
});
});
Expand Down

0 comments on commit 0d6864e

Please sign in to comment.