added test for timeline; fixed mocha tests to properly mock and restore middleware