API testing using SuperTest

I’m trying to do this tutorial, but I can’t get it to run. I think I’m missing some files, specifically it refers to an app.js file, but not sure what’s in it to get this to run properly. Anyone else have better luck with this?

https://www.codecademy.com/paths/back-end-engineer-career-path/tracks/becp-test-driven-development-with-javascript/modules/fscp-learn-server-testing-with-tdd/external_resources/ext-tut-api-testing-using-supertest

Hey bit9444539676
the relative step of the tutorial states:

we need to pass the http.Server to the request() method of supertest. To do that let’s include our express app as follows.

const app = require('../app'); //reference to you app.js file

So this means that you need to have created an Express app.js that you want to test

Ahh thanks, incomplete tutorial it sounds like.

I suppose it builds up on previous lessons, I haven’t followed that course yet. If this solves your issue, please mark it so. Thanks :slight_smile:

1 Like