Typescript Test If Array Function In Angularjs