// The token screen, the Send screen and the confirmation screen for the // contract at USDC's mainnet address. No address holds it and the user does // not track it, so only the bundled token list can name it. // // The bundled token list holds Ethereum Mainnet contracts, so these screens // name the token from it on Ethereum Mainnet only // (https://git.eeqj.de/sneak/AutistMask/issues/632). Driven through the real // popup over a stored profile. const { bootPopup, cleanupPopup, unversionedValidProfile, } = require("./support/popupBoot"); const USDC = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"; const RECIPIENT = "0x711e691962E5c054b78071C789A0C8CE657377aD"; afterEach(() => { cleanupPopup(); }); // The popup reopened onto AddressToken for USDC's address, on `networkId`. function bootOnToken(networkId) { return bootPopup( unversionedValidProfile({ networkId, currentView: "address-token", viewStack: ["main", "address"], selectedWallet: 0, selectedAddress: 0, selectedToken: USDC, }), ); } // AddressToken's Send, then Review for 1 token to RECIPIENT. async function reviewSend(boot) { await boot.click("btn-address-token-send"); expect(boot.visibleViews()).toEqual(["send"]); boot.node("send-to").value = RECIPIENT; boot.node("send-amount").value = "1"; await boot.click("btn-send-review"); expect(boot.visibleViews()).toEqual(["confirm-tx"]); } describe("on Ethereum Mainnet, the bundled list names the token", () => { test("on the token screen", async () => { const boot = await bootOnToken("mainnet"); expect(boot.visibleViews()).toEqual(["address-token"]); expect(boot.text("address-token-title")).toContain("USDC"); const info = boot.node("address-token-contract-info").innerHTML; expect(info).toContain( 'Decimals: 6', ); }); test("on the Send screen and the confirmation screen", async () => { const boot = await bootOnToken("mainnet"); await reviewSend(boot); expect(boot.text("send-balance")).toContain("USDC"); expect(boot.text("confirm-amount")).toContain("USDC"); }); }); describe("with Sepolia active, the bundled list does not name the token", () => { test("on the token screen", async () => { const boot = await bootOnToken("sepolia"); expect(boot.visibleViews()).toEqual(["address-token"]); expect(boot.text("address-token-title")).not.toContain("USDC"); const info = boot.node("address-token-contract-info").innerHTML; expect(info).not.toContain("Decimals:"); }); test("on the Send screen and the confirmation screen", async () => { const boot = await bootOnToken("sepolia"); await reviewSend(boot); expect(boot.text("send-balance")).not.toContain("USDC"); expect(boot.text("confirm-amount")).not.toContain("USDC"); }); });