Guest User

Untitled

a guest
May 24th, 2017
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. promise_test(async t => {
  2.   const unsupportedMethodData = {
  3.     data: {
  4.       supportedNetworks: ["NOT SUPPORTED"],
  5.       supportedTypes: ["NOT SUPPORTED"],
  6.     },
  7.   };
  8.   const unsupportedMethod = Object.assign({}, basicCard, unsupportedMethodData);
  9.   debugger;
  10.   const request = new PaymentRequest([unsupportedMethod], defaultDetails);
  11.   try {
  12.     // There is no way to tell promise_rejects to timeout in the harness
  13.     // wich causes which mean .abort() can't be reached otherwise.
  14.     await new Promise(async (resolve, reject) => {
  15.       const id = setTimeout(() => {
  16.         reject(
  17.           new Error("Should have rejected with NotSupportedError, but timed out?")
  18.         );
  19.       }, 1000);
  20.       try {
  21.         await promise_rejects(t, "NotSupportedError", request.show());
  22.       } catch (err) {
  23.         return reject(err);
  24.       }
  25.       resolve();
  26.     });
  27.   } catch (err) {
  28.     assert_true(false, `Something went wrong: "${err.message}"`);
  29.   } finally {
  30.     await request.abort();
  31.   }
  32. }, `If this consultation produced no supported method of paying, then reject acceptPromise with a "NotSupportedError" DOMException`);
Advertisement
Add Comment
Please, Sign In to add comment