Next.js Discord

Discord Forum

is async await allowed in .then()

Unanswered
SID posted this in #help-forum
Open in Discord
SIDOP
i am using async await in then inside cypress test is this allowed ?
    cy.visitPage(`/sell/validate`, InitialParams).then(async () => {
      const data = await spreadsheetService().getOrderInitiated(
        paymentRequest!
      );
      if (!data || data instanceof Error) {
        throw new Error("No data found");
      }
      const response = await sendPayment(paymentRequest!);
      if (response !== "SUCCESS") {
        throw new Error(`Status is not success got: ${response}`);
      }
      try {
        await confirmPayment(paymentHash!);
      } catch (error) {
        throw new Error(String(error));
      }
    });
  });

0 Replies