please don't use setTimeout-based tests.

You can probably return the new request from addNewAlarm too, so that you can call onsuccess/onerror when you want in the test itself. Or store the request in an external variable.