tests: add unit tests for notificationsctrl and make the code simpler