Skip to content

Commit 3370f00

Browse files
authored
add error throwing for new unit tests (#73)
1 parent 79eb50a commit 3370f00

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tests/gateway.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ describe("Gateway", () => {
229229
gatewayProgram.programId
230230
);
231231
await gatewayProgram.account.whitelistEntry.fetch(entryAddress);
232+
throw new Error("Expected error not thrown"); // This line will make the test fail if no error is thrown
232233
} catch (err) {
233234
expect(err.message).to.include("Account does not exist or has no data");
234235
}
@@ -623,6 +624,7 @@ describe("Gateway", () => {
623624
wallet2.publicKey,
624625
gatewayProgram
625626
);
627+
throw new Error("Expected error not thrown"); // This line will make the test fail if no error is thrown
626628
} catch (err) {
627629
expect(err).to.be.instanceof(anchor.AnchorError);
628630
expect(err.message).to.include("NonceMismatch.");
@@ -661,7 +663,7 @@ describe("Gateway", () => {
661663
s.toArrayLike(Buffer, "be", 32),
662664
]);
663665
try {
664-
gatewayProgram.methods
666+
await gatewayProgram.methods
665667
.withdrawSplToken(
666668
usdcDecimals,
667669
amount,
@@ -676,6 +678,7 @@ describe("Gateway", () => {
676678
recipient: wallet2.publicKey,
677679
})
678680
.rpc({ commitment: "processed" });
681+
throw new Error("Expected error not thrown"); // This line will make the test fail if no error is thrown
679682
} catch (err) {
680683
expect(err).to.be.instanceof(anchor.AnchorError);
681684
expect(err.message).to.include("TSSAuthenticationFailed");
@@ -856,6 +859,7 @@ describe("Gateway", () => {
856859
whitelistCandidate: mint.publicKey,
857860
})
858861
.rpc();
862+
throw new Error("Expected error not thrown"); // This line will make the test fail if no error is thrown
859863
} catch (err) {
860864
expect(err).to.be.instanceof(anchor.AnchorError);
861865
expect(err.message).to.include("TSSAuthenticationFailed.");
@@ -892,6 +896,7 @@ describe("Gateway", () => {
892896
whitelistCandidate: mint.publicKey,
893897
})
894898
.rpc();
899+
throw new Error("Expected error not thrown"); // This line will make the test fail if no error is thrown
895900
} catch (err) {
896901
expect(err).to.be.instanceof(anchor.AnchorError);
897902
expect(err.message).to.include("NonceMismatch.");

0 commit comments

Comments
 (0)