import { describe, expect, it } from "vitest"; import { render, screen, waitFor } from "~test/react-render.js"; import { TEST_CLIENT } from "~test/test-clients.js"; import { AccountProvider } from "../../../../core/account/provider.js"; import { AccountName } from "./name.js"; describe.runIf(process.env.TW_SECRET_KEY)("AccountName component", () => { it("should return the correct social name", () => { render( , ); waitFor(() => expect( screen.getByText("kien-ngo", { exact: true, selector: "span", }), ).toBeInTheDocument(), ); }); it("should return the correct FORMATTED social name", () => { render( `${str}-formatted`} /> , ); waitFor(() => expect( screen.getByText("kien-ngo-formatted", { exact: true, selector: "span", }), ).toBeInTheDocument(), ); }); it("should fallback properly when fail to resolve social name", () => { render( oops} /> , ); waitFor(() => expect( screen.getByText("oops", { exact: true, selector: "span", }), ).toBeInTheDocument(), ); }); });