Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- promise_test(async t => {
- const unsupportedMethodData = {
- data: {
- supportedNetworks: ["NOT SUPPORTED"],
- supportedTypes: ["NOT SUPPORTED"],
- },
- };
- const unsupportedMethod = Object.assign({}, basicCard, unsupportedMethodData);
- debugger;
- const request = new PaymentRequest([unsupportedMethod], defaultDetails);
- try {
- // There is no way to tell promise_rejects to timeout in the harness
- // wich causes which mean .abort() can't be reached otherwise.
- await new Promise(async (resolve, reject) => {
- const id = setTimeout(() => {
- reject(
- new Error("Should have rejected with NotSupportedError, but timed out?")
- );
- }, 1000);
- try {
- await promise_rejects(t, "NotSupportedError", request.show());
- } catch (err) {
- return reject(err);
- }
- resolve();
- });
- } catch (err) {
- assert_true(false, `Something went wrong: "${err.message}"`);
- } finally {
- await request.abort();
- }
- }, `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