Skip to content

Commit

Permalink
test: check address input is cleaned on direction switch
Browse files Browse the repository at this point in the history
  • Loading branch information
kiocosta committed Jan 14, 2025
1 parent 09e86b1 commit 210f2e6
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion tests/components/Reverse.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { fireEvent, render } from "@solidjs/testing-library";

import Reverse from "../../src/components/Reverse";
import { BTC, LN } from "../../src/consts/Assets";
import { BTC, LBTC, LN } from "../../src/consts/Assets";
import { TestComponent, contextWrapper, signals } from "../helper";

describe("Reverse", () => {
Expand All @@ -28,4 +28,30 @@ describe("Reverse", () => {
expect(signals.assetSend()).toEqual(LN);
expect(signals.assetReceive()).toEqual(BTC);
});

test("should reverse and clean onChainAddress", () => {
const {
container: { firstChild: flip },
} = render(
() => (
<>
<Reverse />
<TestComponent />
</>
),
{
wrapper: contextWrapper,
},
);

signals.setOnchainAddress('2N17VNGbi4yUHtkD7vhrc8cpi9JGVmC8scn');
signals.setAssetSend(LBTC);
signals.setAssetReceive(BTC);

fireEvent.click(flip);

expect(signals.onchainAddress()).toEqual('');
expect(signals.assetSend()).toEqual(BTC);
expect(signals.assetReceive()).toEqual(LBTC);
});
});

0 comments on commit 210f2e6

Please sign in to comment.