Skip to content

Commit

Permalink
solana: reformat test
Browse files Browse the repository at this point in the history
  • Loading branch information
a5-pickle committed Aug 4, 2023
1 parent 626eb10 commit 8cbd9c0
Showing 1 changed file with 8 additions and 23 deletions.
31 changes: 8 additions & 23 deletions cross-chain/solana/tests/02__wormholeGateway.ts
Original file line number Diff line number Diff line change
@@ -1,38 +1,24 @@
import { redeemOnSolana, tryNativeToHexString } from "@certusone/wormhole-sdk";
import { MockEthereumTokenBridge } from "@certusone/wormhole-sdk/lib/cjs/mock";
import * as tokenBridge from "@certusone/wormhole-sdk/lib/cjs/solana/tokenBridge";
import * as coreBridge from "@certusone/wormhole-sdk/lib/cjs/solana/wormhole";
import * as anchor from "@coral-xyz/anchor";
import { AnchorError, Program } from "@coral-xyz/anchor";
import {
getAccount,
getAssociatedTokenAddressSync,
getMint,
} from "@solana/spl-token";
import { Program } from "@coral-xyz/anchor";
import { getAccount, getAssociatedTokenAddressSync } from "@solana/spl-token";
import { PublicKey } from "@solana/web3.js";
import { expect } from "chai";
import { WormholeGateway } from "../target/types/wormhole_gateway";
import {
ETHEREUM_TBTC_ADDRESS,
ETHEREUM_TOKEN_BRIDGE_ADDRESS,
GUARDIAN_SET_INDEX,
CORE_BRIDGE_PROGRAM_ID,
TOKEN_BRIDGE_PROGRAM_ID,
TBTC_PROGRAM_ID,
WORMHOLE_GATEWAY_PROGRAM_ID,
WRAPPED_TBTC_MINT,
ethereumGatewaySendTbtc,
expectIxFail,
expectIxSuccess,
generatePayer,
getOrCreateAta,
mockSignAndPostVaa,
preloadWrappedTbtc,
ethereumGatewaySendTbtc,
transferLamports,
getTokenBridgeSequence,
} from "./helpers";
import * as tbtc from "./helpers/tbtc";
import * as wormholeGateway from "./helpers/wormholeGateway";
import { PublicKey } from "@solana/web3.js";

async function setup(
program: Program<WormholeGateway>,
Expand Down Expand Up @@ -354,7 +340,6 @@ describe("wormhole-gateway", () => {
depositAmount
);
await expectIxFail([ix], [payer], "AccountNotInitialized");

});
it("deposit wrapped tokens", async () => {
// Set up new wallet
Expand Down Expand Up @@ -430,7 +415,7 @@ describe("wormhole-gateway", () => {
expect(tbtcAfter.amount).to.equal(tbtcBefore.amount + depositAmount);
expect(gatewayAfter.amount).to.equal(
gatewayBefore.amount + depositAmount
);
);
});

it("cannot deposit wrapped tbtc (minting limit exceeded)", async () => {
Expand Down Expand Up @@ -511,7 +496,7 @@ describe("wormhole-gateway", () => {

describe("receive tbtc", () => {
let replayVaa;

it("receive tbtc", async () => {
// Set up new wallet
const payer = await generatePayer(authority);
Expand Down Expand Up @@ -560,7 +545,7 @@ describe("wormhole-gateway", () => {

// Check balance change.
expect(tbtcAfter.amount).to.equal(tbtcBefore.amount + sentAmount);
expect(gatewayAfter.amount).to.equal(gatewayBefore.amount + sentAmount);
expect(gatewayAfter.amount).to.equal(gatewayBefore.amount + sentAmount);

// Save vaa.
replayVaa = signedVaa;
Expand Down Expand Up @@ -1042,7 +1027,7 @@ describe("wormhole-gateway", () => {
}
);
await expectIxFail([ix], [commonTokenOwner], "AccountNotInitialized");
});
});
});

describe("send wrapped tbtc", () => {
Expand Down

0 comments on commit 8cbd9c0

Please sign in to comment.