Skip to content

Commit

Permalink
test: check onchain address is cleared if assetReceive did change
Browse files Browse the repository at this point in the history
  • Loading branch information
kiocosta committed Jan 15, 2025
1 parent 5a73067 commit 091c9d4
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/components/AssetSelect.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,30 @@ describe("AssetSelect", () => {
expect(signals.onchainAddress()).toEqual(address);
},
);

test("should clear onchain address when assetReceive changes", async () => {
render(
() => (
<>
<TestComponent />
<SelectAsset />
</>
),
{ wrapper: contextWrapper },
);

const initialAddress =
"el1qqgdvkht3g2puwdwxqzfrekef8anygnvs093hntsz63f42gj5m0zksfvvvsss79pv7le474snv6n2slklg7ujvth99naldh9cy";

signals.setOnchainAddress(initialAddress);
signals.setAssetSelect(true);
signals.setAssetSelected(Side.Receive);
signals.setAssetSend(BTC);
signals.setAssetReceive(LBTC);

fireEvent.click(await screen.findByTestId(`select-${BTC}`));

expect(signals.assetReceive()).toEqual(BTC);
expect(signals.onchainAddress()).toBe("");
});
});

0 comments on commit 091c9d4

Please sign in to comment.