Step 11

Notice the output of Jest:

This is a condensed output. If you want more details, such as the name of the tests, update the jest.config.js file as follows:

  module.exports = {
    preset: "@shelf/jest-mongodb",
+   verbose: true,
  };

Rerun the tests; you should see an output similar to this:

Notice all the tests run every time. If you want to focus on one test only, you can decorate it with .only:

- test("Return 200 when authentication is sucessfull", async () => {
+ test.only("Return 200 when authentication is sucessfull", async () => {
    const response = await request.post("/authenticate").send({
      username: "testclient",
      password: "testclient",
    });
    expect(response.status).toBe(200);
  });

Rerun the tests; you should see an output similar to this:

You can decorate describe with .only to focus on one suite of tests. Moreover, you can use the .skip on tests to explicitly skip them! For example, update the tests/index.test.js as follows.

- test("Get 200 for API homepage", async () => {
+ test.skip("Get 200 for API homepage", async () => {
    const response = await request.get("/");
    expect(response.status).toBe(200);
  });

Rerun the tests; you should see an output similar to this: