-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2316 from trilitech/fix-buy-tez-url-on-web
[WEB] Fix buy TEZ url
- Loading branch information
Showing
10 changed files
with
164 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { mockImplicitAccount, mockMnemonicAccount } from "@umami/core"; | ||
import { | ||
type UmamiStore, | ||
accountsActions, | ||
addTestAccount, | ||
makeStore, | ||
networksActions, | ||
} from "@umami/state"; | ||
import { GHOSTNET, MAINNET } from "@umami/tezos"; | ||
|
||
import { Tokens } from "./Tokens"; | ||
import { render, screen, waitFor } from "../../testUtils"; | ||
|
||
let store: UmamiStore; | ||
const account = mockImplicitAccount(0); | ||
|
||
beforeEach(() => { | ||
store = makeStore(); | ||
addTestAccount(store, account); | ||
store.dispatch(accountsActions.setCurrent(account.address.pkh)); | ||
}); | ||
|
||
describe("<Tokens />", () => { | ||
beforeEach(() => { | ||
addTestAccount(store, mockMnemonicAccount(1)); | ||
addTestAccount(store, mockMnemonicAccount(2)); | ||
store.dispatch(networksActions.setCurrent(MAINNET)); | ||
}); | ||
|
||
describe("without tokens", () => { | ||
it("displays an empty state", async () => { | ||
render(<Tokens />, { store }); | ||
|
||
await waitFor(() => { | ||
expect(screen.getByTestId("empty-state-message")).toBeVisible(); | ||
}); | ||
|
||
expect(screen.getByText("Get Started with Tokens")).toBeVisible(); | ||
expect( | ||
screen.getByText("You need Tez to take part in any activity. Buy some to get started.") | ||
).toBeVisible(); | ||
expect(screen.getByText("Buy Tez Now")).toBeVisible(); | ||
expect(screen.queryByTestId("token-card")).not.toBeInTheDocument(); | ||
}); | ||
|
||
it("has correct mainnet Buy Tez link", async () => { | ||
store.dispatch(networksActions.setCurrent(MAINNET)); | ||
render(<Tokens />, { store }); | ||
|
||
await waitFor(() => { | ||
expect(screen.getByTestId("empty-state-message")).toBeVisible(); | ||
}); | ||
const link = screen.getByRole("link", { name: "Buy Tez Now" }); | ||
expect(link).toHaveAttribute( | ||
"href", | ||
`https://widget.wert.io/default/widget/?commodity=XTZ&address=${account.address.pkh}&network=tezos&commodity_id=xtz.simple.tezos` | ||
); | ||
}); | ||
|
||
it("has correct ghostnet Buy Tez link", async () => { | ||
store.dispatch(networksActions.setCurrent(GHOSTNET)); | ||
render(<Tokens />, { store }); | ||
|
||
await waitFor(() => { | ||
expect(screen.getByTestId("empty-state-message")).toBeVisible(); | ||
}); | ||
const link = screen.getByRole("link", { name: "Buy Tez Now" }); | ||
expect(link).toBeVisible(); | ||
expect(link).toHaveAttribute("href", "https://faucet.ghostnet.teztnets.com/"); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87edd3a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.