mirror of
https://github.com/aljazceru/mutiny-web.git
synced 2026-02-01 04:24:32 +01:00
throw error if faucet fails
This commit is contained in:
@@ -54,21 +54,23 @@ test("rountrip receive and send", async ({ page }) => {
|
||||
// The SVG's value property includes "lightning:l"
|
||||
expect(value).toContain("lightning:l");
|
||||
|
||||
const lightningInvoice = value?.split("lightning:")[1];
|
||||
|
||||
// Post the lightning invoice to the server
|
||||
const _response = await fetch(
|
||||
"https://faucet.mutinynet.com/api/lightning",
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
bolt11: lightningInvoice
|
||||
})
|
||||
}
|
||||
);
|
||||
const response = await fetch("https://faucet.mutinynet.com/api/lightning", {
|
||||
method: "POST",
|
||||
mode: "cors",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
bolt11: value
|
||||
})
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
response.text().then((text) => {
|
||||
throw new Error("failed to post invoice to faucet: " + text);
|
||||
});
|
||||
}
|
||||
|
||||
// Wait for an h1 to appear in the dom that says "Payment Received"
|
||||
await page.waitForSelector("text=Payment Received", { timeout: 30000 });
|
||||
|
||||
@@ -18,7 +18,7 @@ export function FederationPopup() {
|
||||
|
||||
return (
|
||||
<SimpleDialog
|
||||
title={i18n.t("activity.federation_message")}
|
||||
title={`${i18n.t("activity.federation_message")}: ${state.expiration_warning?.federationName}`}
|
||||
open={showFederationExpirationWarning()}
|
||||
setOpen={(open: boolean) => {
|
||||
if (!open) {
|
||||
|
||||
@@ -89,7 +89,11 @@ export const makeMegaStoreContext = () => {
|
||||
federations: undefined as MutinyFederationIdentity[] | undefined,
|
||||
balanceView: localStorage.getItem("balanceView") || "sats",
|
||||
expiration_warning: undefined as
|
||||
| { expiresTimestamp: number; expiresMessage: string }
|
||||
| {
|
||||
expiresTimestamp: number;
|
||||
expiresMessage: string;
|
||||
federationName: string;
|
||||
}
|
||||
| undefined,
|
||||
expiration_warning_seen: false
|
||||
});
|
||||
@@ -233,14 +237,19 @@ export const makeMegaStoreContext = () => {
|
||||
const federations = await sw.list_federations();
|
||||
|
||||
let expiration_warning:
|
||||
| { expiresTimestamp: number; expiresMessage: string }
|
||||
| {
|
||||
expiresTimestamp: number;
|
||||
expiresMessage: string;
|
||||
federationName: string;
|
||||
}
|
||||
| undefined = undefined;
|
||||
|
||||
federations.forEach((f) => {
|
||||
if (f.popup_countdown_message && f.popup_end_timestamp) {
|
||||
expiration_warning = {
|
||||
expiresTimestamp: f.popup_end_timestamp,
|
||||
expiresMessage: f.popup_countdown_message
|
||||
expiresMessage: f.popup_countdown_message,
|
||||
federationName: f.federation_name
|
||||
};
|
||||
}
|
||||
});
|
||||
@@ -485,14 +494,19 @@ export const makeMegaStoreContext = () => {
|
||||
const federations = await sw.list_federations();
|
||||
|
||||
let expiration_warning:
|
||||
| { expiresTimestamp: number; expiresMessage: string }
|
||||
| {
|
||||
expiresTimestamp: number;
|
||||
expiresMessage: string;
|
||||
federationName: string;
|
||||
}
|
||||
| undefined = undefined;
|
||||
|
||||
federations.forEach((f) => {
|
||||
if (f.popup_countdown_message && f.popup_end_timestamp) {
|
||||
expiration_warning = {
|
||||
expiresTimestamp: f.popup_end_timestamp,
|
||||
expiresMessage: f.popup_countdown_message
|
||||
expiresMessage: f.popup_countdown_message,
|
||||
federationName: f.federation_name
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user