Due to some infrastructure changes (namely servers & VPNs) there are times I want to run our application in an offline mode. I've been able to implement this with ngMockE2E however it seems to be an all or nothing approach, meaning you have to explicitly set every single HTTP request out of the app.
Is there a way to have it assume that unless you have explicitly set a route/url to be handled that it will automatically call a generic passThrough()
operation?
Currently I am doing this:
noSrvc = $location.search().hasOwnProperty 'nosrvc'
#
# templates
#
$httpBackend.whenGET /(.htm|.html)$/
.passThrough();
#
# session
#
rqst = $httpBackend.whenGET /(api/users/current)$/
if !noSrvc then rqst.passThrough() else rqst.respond {"user":{
# doing something similar for every single service call in the app... gets tedious after about 3-4
Most everything I've read on the subject deals with unit testing and doesn't really address the implied passthrough unless otherwise stated.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…