Commit Graph

9 Commits

Author SHA1 Message Date
Rafa de la Torre
aeec1922ee Fix test and add const #543 2018-12-05 19:15:57 +01:00
Rafa de la Torre
b6251568eb Test first, with hardcoded values (WIP) #543 2018-12-05 18:59:11 +01:00
Rafa de la Torre
8505857412 Make error_handler.test.js independent from other tests #543
This is needed to avoid a "test race" and get it closer to a real unit
test.

When running it along with others it passes:

```
$ make test-unit
...
  48 passing (54ms)
  12 pending
```

(note it relies on the ordering produced by `find`)

when running it along with some other test that reads the config, it
works as well:

```
$ test/run_tests.sh  test/unit/apikeyauth.test.js test/unit/error_handler.test.js
...
  3 passing (9ms)
  12 pending
```

but when run in isolation, it fails:

```
$ test/run_tests.sh test/unit/error_handler.test.js
...
  0 passing (15ms)
  3 failing

  1) error-handler should return a header with errors:
     TypeError: Cannot read property 'environment' of undefined
      at errorMiddleware (app/middlewares/error.js:10:28)
      at Context.<anonymous> (test/unit/error_handler.test.js:53:26)

  2) error-handler JSONP should return a header with error statuscode:
     TypeError: Cannot read property 'environment' of undefined
      at errorMiddleware (app/middlewares/error.js:10:28)
      at Context.<anonymous> (test/unit/error_handler.test.js:79:26)

  3) error-handler should escape chars that broke logs regex:
     TypeError: Cannot read property 'environment' of undefined
      at errorMiddleware (app/middlewares/error.js:10:28)
      at Context.<anonymous> (test/unit/error_handler.test.js:108:26)
```
2018-12-05 16:22:48 +01:00
Simon Martín
d727a50407 jshint 2018-03-28 12:17:42 +02:00
Simon Martín
152ef05028 removing forgotten only 2018-03-28 12:15:23 +02:00
Simon Martín
8e5ac72411 simplify error_handler tests 2018-03-28 12:10:48 +02:00
Daniel García Aubert
edd382fb8f Check user is the same user that sends the request when basic-auth is provided 2018-02-16 18:21:06 +01:00
Simon Martín
47b6ae65f5 test escape chars function 2017-12-18 12:46:03 +01:00
Simon Martín
43598cafe6 test ensuring errors header 2017-11-28 17:19:48 +01:00