Mock all setTimeout / setInterval in Jest and wait for pending timeouts

There is no need to wait in tests and Jest supports mocking timer. We should add that to our Jest setup and also ensure that all registered timeouts / intervals are cleared after the tests.

see also https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/21426/diffs?commit_id=09c332bd200fc09267e515ef7b656c46b9dc7f07