Commit Graph

16 Commits

Author SHA1 Message Date
Paul Melnikow
64e9d13e76 Disallow unused variables and turn on a few recommended rules 2017-04-12 23:55:13 +02:00
Paul Melnikow
de18dce94a Add more test helpers
While working on some tests, I was having a tricky problem in a test suite. Eventually I tracked it down to an interaction between tests. I suspected the test library, but once I tried to make an isolated test case, I realized the test library was working fine. It turns out it was the server’s request cache. The fix is to clear the cache between tests.

Not needed for this PR, though I’m adding it to this branch because it conflicts with this change.
2017-04-12 23:13:16 +02:00
Paul Melnikow
5a45003bc3 Test server logic for img2svg error, and run the server in-process
Running the server in process is necessary for the mock to work. This is an approach I’ve taken in the past. I experimented with this setup quite a bit when I was playing around with a test suite, and it seemed to work well enough. Setting `process.argv` is a admitedly a bit gross, though a cleaner approach would require more involved changes to `server.js`.
2017-04-12 23:13:16 +02:00
Paul Melnikow
8b77d16a72 Always call the callback + reliable erroring
Fixes #914
2017-04-12 23:13:16 +02:00
Paul Melnikow
0760d17d82 Return data from svg2img via callback
Given the chunks coming from imagemagick are getting stored memory and
then tucked into a cache, this function could as easily return a buffer
via callback. Streaming is just making it more complex. (And trickier to
test!)
2017-04-12 23:13:16 +02:00
Paul Melnikow
ad1e419d42 Add tests for svgToImg 2017-04-12 23:13:16 +02:00
Paul Melnikow
3905424d1c Add a test for badge.js and refactor 2017-04-12 23:13:16 +02:00
Thaddee Tyl
522e09f509 Add missing var
It was fogotten when rebasing 5f945d48.
2017-03-30 23:40:49 +02:00
Paul Melnikow
1930d9fdd9 Change some .on to .once to make tests less flaky 2017-03-30 00:18:30 +02:00
Paul Melnikow
076bd384d5 Use a glob pattern instead of hard-coding filenames 2017-03-30 00:18:30 +02:00
Paul Melnikow
5f945d4856 Use Mocha to make tests more reliable 2017-03-30 00:18:30 +02:00
Paul Melnikow
d985f81f8e Disallow undefined variables 2017-03-29 20:09:30 +02:00
Paul Melnikow
0def6470a7 Disallow variable redeclaration 2017-03-26 20:02:56 -04:00
Thaddee Tyl
5dd58142cb Fix LRU cache index stalling
The old LRU implementation stored a list's indices to reference items in that
list, but deletions from the list made indices point to the wrong slot.

Functionally, it meant that deleted slots were not guaranteed to be the oldest
slot.

Using a linked list fixes that.
2017-03-26 23:00:31 +02:00
Paul Melnikow
47a8bf51dc First pass for linting on PRs 2017-03-20 16:54:27 -04:00
Thaddee Tyl
6349c5c24a Put all test-related files in test/ 2016-06-14 08:26:57 +02:00