add unit test for alert logic