Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: promise returned on fetch missing finally #616

Closed
wants to merge 2 commits into from

Conversation

magizh-okta
Copy link
Contributor

@magizh-okta magizh-okta commented Feb 3, 2021

  • In Edge 17 and lower the promise returned by fetch api call doesnt have
    finally on it.

  • Fix is if finally is not present on promise returned by fetch we explicitly wrap it with
    a promise.

RESOLVES: OKTA-367504

Chrome

chrome.mov

Edge

edge17.mov

* In Edge 17 and lower the promise returned by fetch api call doesnt have
finally on it.

* Fix is if finally is not present on promise returned by fetch we explicitly wrap it with
a promise.

RESOLVES: OKTA-367504
});
it('fetchRequest returns a promise with finally on it even if fetch doesnt return a promise with fetch', () => {
const globalFetch = jest.fn(() => {
const resolvedPromise = Promise.resolve(response);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case can we return a bare object? or

{
  then: jest.fn(),
  catch: jest.fn()
 }

I want to be sure finally cannot be called through the prototype, it should never exist.

Copy link
Contributor

@aarongranick-okta aarongranick-okta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good! see 1 comment on test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants