S
S
sergey19982018-05-15 16:59:37
Software testing
sergey1998, 2018-05-15 16:59:37

How to test this piece on JEST?

static get(action, params = {}) {

        return new Promise((resolve, reject) => {
          fetch(UrlHelper.apiUrl(action, params), {
            credentials: 'same-origin'
          })
            .then(response => {
              return Api.checkStatus(resolve, reject, response)
            })
            .then(([ ok, response ]) => {
              return ok ? resolve(response) : reject(response);
            });
        });
     }

How to test this piece on JEST ?
This is part of the API, so you don't actually need to make any requests.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mikita_du, 2020-03-18
@mikita_du

https://medium.com/@rishabhsrao/mocking-and-testin...
as an option

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question