A few general improvements to the test suite #1753
This updates the test suite with a few small improvements and bug fixes that should help improve stability.
Noticed a couple of tests that weren't returning Promises properly, so decided to go over all of them. Turns out there were quite a few more in the same situation. This explains why the test suite would fail sometimes and run perfectly fine next.
Since I was already there also applied a bit of formatting to some parts that were very different from the rest of the files, fixed or removed commented out test cases and removed unused code.
Current PR Issues
This doesn't make the test suite much better. There are still a lot of cases of huge tests that try to do too much. These should be split into smaller ones eventually. There are also tests that don't actually test the thing they claim to be testing, but test for side-effects instead.