Skip to content

Commit

Permalink
fixup TransactionClaim.spec
Browse files Browse the repository at this point in the history
  • Loading branch information
dni committed Jul 23, 2024
1 parent 5e2e731 commit 3260e30
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 26 deletions.
8 changes: 1 addition & 7 deletions src/pages/Pay.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
import { useParams } from "@solidjs/router";
import log from "loglevel";
import {
Match,
Show,
Switch,
createEffect,
onCleanup,
} from "solid-js";
import { Match, Show, Switch, createEffect, onCleanup } from "solid-js";

import LoadingSpinner from "../components/LoadingSpinner";
import { SwapIcons } from "../components/SwapIcons";
Expand Down
26 changes: 7 additions & 19 deletions tests/status/TransactionClaimed.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,18 @@
import { render, screen } from "@solidjs/testing-library";

import { BTC, LBTC, RBTC } from "../../src/consts/Assets";
import { BTC, LBTC, LN, RBTC } from "../../src/consts/Assets";
import i18n from "../../src/i18n/i18n";
import TransactionClaimed from "../../src/status/TransactionClaimed";
import { TestComponent, contextWrapper, payContext } from "../helper";

jest.mock("../../src/utils/boltzClient", () => ({
getReverseTransaction: jest.fn().mockResolvedValue({
hex: "txHex",
}),
}));

describe("TransactionClaimed", () => {
beforeEach(() => {
jest.clearAllMocks();
});

test.each`
name | swap
${"normal swaps"} | ${{ reverse: false }}
${"reverse swaps to RBTC"} | ${{
reverse: true,
asset: RBTC,
}}
${"reverse swaps to BTC with claim transactions"} | ${{ reverse: true, asset: BTC, claimTx: "txid" }}
${"reverse swaps to L-BTC with claim transactions"} | ${{ reverse: true, asset: LBTC, claimTx: "txid" }}
name | swap
${"normal swaps"} | ${{ assetSend: RBTC, assetReceive: LN, address: "address" }}
${"reverse swaps to RBTC"} | ${{ assetSend: LN, assetReceive: RBTC, claimTx: "txid" }}
${"reverse swaps to BTC with claim transactions"} | ${{ assetSend: LN, assetReceive: LBTC, claimTx: "txid" }}
${"reverse swaps to L-BTC with claim transactions"} | ${{ assetSend: LN, assetReceive: BTC, claimTx: "txid" }}
${"chain swaps BTC to L-BTC with claim transactions"} | ${{ assetSend: BTC, assetReceive: LBTC, claimTx: "txid" }}
`("should show success for $name", async ({ swap }) => {
render(
() => (
Expand Down

0 comments on commit 3260e30

Please sign in to comment.