seriema / angular-apimock

Automatically route your API calls to static JSON files, for hiccup free front–end development.

Home Page:johansson.jp/angular-apimock

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Create unit test for the httpInterceptor, multiple cases.

ceoaliongroo opened this issue · comments

Describe for the httpInterceptor, the unit test for different URL and Methods, also compatibility of work with other interceptors or external data services like firebase, simperium, parse, etc.

Example:
GET, http://server/api/test
POST, http://server/api/test/new
DELETE, http://production.firebase.io/api/test/1
PUT, http://server/api/test/4
GET, /api/test
GET, /test

My specific case, i have a http interceptor that include the base server uri. This need compatibility.

@ceoaliongroo are you happy with the commit or did you mean something else?

I don't know, i want to research little more about best practices of test for http interceptors.

It's ok for you? leave open the issue open

Ok, I'll leave this to you then. Thanks!

I have changed the tests so now it's only full tests from the "outside". Maybe it should be called E2E tests? Anyway, I have included GET/PUT/POST/DELETE. Take a look if that's what you meant so we can try to close this.

@ceoaliongroo are you still interested in doing this?

thanks for ask @seriema, i don't know if is worthy; also many changes into angular, Do you think it's necessary?

@ceoaliongroo Those tests would be useful. Not sure what you mean by the changes in angular? Do you mean the new 1.3?

yes the new version, angularjs 1.3

@ceoaliongroo Not sure what changed with 1.3 that changes apiMock? The httpInterceptor interface looks the same.

I just tried the code with 1.3 and it seems to work.