sahat/satellizer — pull request #172 by dsimmons (2014-10-25 20:43:11+00:00)
Title: [Fix]: Amend failing Travis specs.

Fixed failing Travis build due to changes introduced by #171 (although tests passed locally).

The TL;DR is that I'm an idiot and the flow wasn't completely correct. ***However***, one important thing to note is that the reason it passed locally was due to shared mutable state (particularly due to changes made by `config.spec.js`) and a race condition of sorts that had different behavior on Travis.

So, with that said, although it's probably outside of the scope of this PR, some work probably needs to be done to either sandbox existing tests and/or to add more extensive cleanup. As-is, it's dangerous in that the existing state carried between spec suites could provide false negatives (like in my case) or even worse, false positives.

A few examples while it's still fresh -- the state as it exists before the first test in `http.spec.js` is run:

- `window.localStorage` - Several tokens present. Because some of the `satellizer.js` logic depends on whether a token is present or not, it could lead to unexpected results.
- Most of `config` are the altered values after `config.spec.js` takes place. For instance, although I dynamically use `config.loginUrl` so it doesn't technically matter (versus if I were trying to hit an exact route), as of my specs running, that route pointed to `/api/signin`.