rschmukler/agenda — pull request #92 by droppedonjapan (2014-09-10 21:56:35+00:00)
Title: Integration Tests (Finally)

So if you look at this PR, you might be amused to see that I stuck with the `child_process.fork()` method for testing here.

Initially I had tried invalidating the `new Agenda()` instance and recreating it, however that led to a lot of odd problems that I couldn't fully figure out, so I scrapped that idea in favor of a way of dynamically loading Agenda jobs in the forked process.

A few caveats with this PR.

1. Set up paths to use `path.join()` to ensure cross-compatibility with non-Unix environments. That being said, I haven't through the rest of the code yet to know if that's true (and the ability to use `Make` on a Windows machine is questionable).

2. Linting: I added some jsHint/ jsLint globals to the top of the test file to get rid of some warnings. That being said, I could have totally included that in my settings to get rid of those warnings, so let me know you want that removed.

3. Other Styling Changes: My default text editor settings trim off whitespace, plus I added semicolons to a block of code that was missing them.

4. Blind Change of Test: On the "should reuse the same job on multiple runs" test, I added the `var counter = 0;` statement to match the surrounding tests. This was a total blindly made change, but the tests passed before and after I made the changes, so I think we're good!

If you want these commits squashed, let me know and I can take care of it.

Do you have any other ideas for integration tests? I thought we might be able to add something to check manual job processing and concurrent Agenda instances, but I'm not super-familiar with that API and figured we could start with these.