I am new to TDD and I am trying to write test code that uses third-party libraries (cross-platform mobile development). I would like to have tests only to test our business logic. Do not worry about their implementation.
Moreover, their libraries are displayed only in their own shells. Since I use js as a development language, I would like to test the use of jasmine and run a test to test my business logic only in a browser.
Here are sample methods that I would like to ignore / layout when testing.
com.companyname.net.checkInternetAvailable(url)
com.companyname.store.getValue(key)
com.companyname.someother.name(whateverObj, callback) etc.,
At the moment I created a new file mocks.jswhere I just wrote
var com = {
"net":{},
"store":{},
"someother":{}
}
com.net.checkInternetAvailable = function(url){
return true;
}
. Jasmine SpyOn(com.net, "checkInternetAvailable").and.returnValue(true) . , SpyOn.
? ?