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

Nock/supertest example #28

Open
matthewdking opened this issue Apr 2, 2018 · 0 comments
Open

Nock/supertest example #28

matthewdking opened this issue Apr 2, 2018 · 0 comments

Comments

@matthewdking
Copy link
Contributor

@eliasCodes example of nock and supertest

test.only('Testing if successfully called API', (t) => {
  nock('https://api.nasa.gov/planetary/apod')
    .get('?date=2018-03-29&api_key=undefined')
    .reply(200, { planet: 'Jupiter', photographer: 'Lawrence' });

  supertest(router)
    .get('/api/search?2018-03-29')
    .expect(200)
    .end((err, res) => {
      t.deepEqual(res.body, { planet: 'Jupiter', photographer: 'Lawrence' });
      t.end();
    });
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant