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

Pokmon API is not available anymore: https://graphql-pokemon.now.sh #28

Closed
gugol2 opened this issue Aug 13, 2020 · 13 comments
Closed

Pokmon API is not available anymore: https://graphql-pokemon.now.sh #28

gugol2 opened this issue Aug 13, 2020 · 13 comments

Comments

@gugol2
Copy link

gugol2 commented Aug 13, 2020

Hi Ken,

Very nice material, thanks.

Just to let you know about this API that you are using for this repo is no longer working:

"ZEIT Now 1.0 is being shut down. As part of this, all ZEIT Now 1.0 Deployments will become inaccessible."

Nothing to do with your code, but just in case I let you know.
The owner of the repo has been notified already: lucasbento/graphql-pokemon#13

Cheers!

@kentcdodds
Copy link
Member

Ha! Dang it. Well, I know what I'm working on now 😅

I've been wanting to replace this with MSW anyway.

Thanks for letting me know.

@gugol2
Copy link
Author

gugol2 commented Aug 13, 2020

Well, apparently it works randomly...

I think replacing it with something else in the long run is a good idea.

Thanks again for this material Kent!

@marcosvega91
Copy link
Contributor

Hey I can submit a PR with MSW implementation if you haven't done yet.
I have only a doubt about react-workshop-app because in the setup-tests.js window.fetch should be mocked.
Maybe an env variable like process.env.MSW_ENABLED can be passed from this repo to react-workshop-app 🤔

@kentcdodds
Copy link
Member

I wouldn't implement this as part of react-workshop-app, but rather in this repo directly. If you'd like to work on this that would be welcome. We could have a similar setup here that we have in the bookshelf app.

@marcosvega91
Copy link
Contributor

marcosvega91 commented Aug 29, 2020

MSW will be imported in this repo but on react-workshop-app side we have this https://github.com/kentcdodds/react-workshop-app/blob/master/src/setup-tests.js that requires that fetch should be mocked
we can do in this way

test('displays the pokemon', async () => {
  window.fetch.mockRestore()
  .......
  jest.spyOn(window, 'fetch')
});

but is not really good

or we can not use the setup-test file from react-workshop-app and do the following in this repo

import '@testing-library/jest-dom/extend-expect'
import '@kentcdodds/react-workshop-app/dist/jest-expect-message'
import {server} from './test/server'

beforeAll(() => {
  jest.spyOn(console, 'info')
  console.info.mockImplementation(() => {})
  server.listen()
})
afterAll(() => {
  console.info.mockRestore()
  server.close()
})

beforeEach(() => console.info.mockClear())

afterEach(() => server.resetHandlers())

@kentcdodds
Copy link
Member

Ah, good point. Hmmmm... I set that up before I discovered MSW. I think the right approach here is to remove that from the react-workshop-app and add it to the individual apps and then later set up MSW instead.

@marcosvega91
Copy link
Contributor

It should be good. I'll make a PR there

@kentcdodds
Copy link
Member

Thanks for the help in the workshop repo @marcosvega91. I'm working on fixing this here now :)

@marcosvega91
Copy link
Contributor

Goood 🚀

@gugol2
Copy link
Author

gugol2 commented Sep 3, 2020

Sorry I didn't realize you wanted collaboration for this issue @kentcdodds

@kentcdodds
Copy link
Member

No worries @gugol2 :) Glad that you reported the issue!

@kentcdodds
Copy link
Member

Actually... That reminds me!

@all-contributors please add @gugol2 for bugs

@allcontributors
Copy link
Contributor

@kentcdodds

I've put up a pull request to add @gugol2! 🎉

paulocuambe pushed a commit to paulocuambe/react-hooks that referenced this issue Sep 9, 2022
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

No branches or pull requests

3 participants