Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix negative tests for update_organization_wallet_v0 #25

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions tests/organization-wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,8 @@ describe("organization wallet", () => {
})
.rpc({ skipPreflight: true });

let logs: string | undefined;

try {
await program.methods
.updateOrganizationWalletV0({
Expand All @@ -356,10 +358,12 @@ describe("organization wallet", () => {
})
.simulate();
} catch (err) {
expect(err.simulationResponse?.logs).to.match(
/caused by account: organization\..*ConstraintHasOne/
);
logs = err.simulationResponse?.logs;
}

expect(logs).to.match(
/caused by account: organization\..*ConstraintHasOne/
);
});

it("should fail if wrong organization", async () => {
Expand All @@ -375,6 +379,8 @@ describe("organization wallet", () => {
})
.rpcAndKeys({ skipPreflight: true });

let logs: string | undefined;

try {
await program.methods
.updateOrganizationWalletV0({
Expand All @@ -388,10 +394,12 @@ describe("organization wallet", () => {
})
.simulate();
} catch (err) {
expect(err.simulationResponse?.logs).to.match(
/caused by account: organization_wallet\..*InvalidOrganization/
);
logs = err.simulationResponse?.logs;
}

expect(logs).to.match(
/caused by account: organization_wallet\..*InvalidOrganization/
);
});
});
});
Expand Down
Loading