Deprecated as of 10.7.0. highlight(lang, code, ...args) has been deprecated. Deprecated as of 10.7.0. Please use highlight(code, options) instead.

Step 3 - It ensures robustness too

Please make sure your are on step 3 in your terminal by typing:

bin/step 3

Testing the robustness against an non existent TODO

In todo-spec/todos/getOne.yml we can find the specification of the GET /todos/{id} endpoint.

Let's see if the API is robust (spoiler: it's not).

As with the examples section, webspicy supports a counterexamples section. Let's add one:


  - description: |-
      it fails with a 404 for non existent todo
      id: 9999
      content_type: text/plain
      status: 404
      - match(/Not Found/)

And let's run webspicy (the ROBUST environment variable is used here to execute counterexamples only):

ROBUST=only webspicy --debug todo-spec/todos/getOne.yml

The test fails: the API returns an empty body with a 200 status code. You can check this by looking at the debug info that was displayed in your terminal:

~> GET
    Req params: {
    Req headers: {
    Res status: 200 OK
    Res headers: {
      "X-Powered-By": "Express",
      "Date": "Fri, 18 Dec 2020 09:34:08 GMT",
      "Connection": "close",
      "Content-Length": "0"
    Res body:

Feel like fixing the API for us before you move on? Edit todo-api/src/index.js.