How to mock out Firebase in Karma tests for Angular app
问题 By following the AngularFire guide, I have synchronized a scope variable with a Firebase array. My code is basically the same as the tutorial (Step 5): https://www.firebase.com/docs/web/libraries/angular/quickstart.html Everything in my app is working, but I am really confused about how to properly mock the Firebase call in my Karma unit tests. I guess something along the lines of using $provide to mock the data? But then $add wouldn't work in my controller methods. Help? 回答1: Copied from