So, to answer the question, we need to consider what we are actually trying to do. If we try unit test , then yes, we need to make fun of all the dependencies.
Mocking your addictions will not be easy. You only need to make fun of what you use.
For example, $firebaseArray launched as a function that receives a parameter, we know that a lot:
var mockFirebaseArray = function(ref) { };
Then, before we finish, we need to make fun of Ref :
var mockRef = { child: function(path) { this.orderByChild = function(path) { this.equalTo = function(val) { }; return this; }; return this; } };
With these things, we can decide how the test will go. We could just use spies. Or we could set local variables that we can assert later on in our path.
Spies are my preferred method, because you can even verify that they were called with specific values:
expect(mockFirebaseArray).toHaveBeenCalled(); expect(mockRef.child).toHaveBeenCalledWith('comments');
Now, if you want to write an integration test that is different. In this case, I still use spyware, but you are actually executing these dependencies. Generally speaking, there is no need to test your dependencies, because they must also be tested in isolation. In addition, there is no need to check other people's APIs if they are from reliable sources.