karma: replaced indexOf with switch/case