seriema / angular-apimock

Automatically route your API calls to static JSON files, for hiccup free front–end development.
johansson.jp/angular-apimock
MIT License
65 stars 8 forks source link

Create unit test for the httpInterceptor, multiple cases. #4

Open ceoaliongroo opened 10 years ago

ceoaliongroo commented 10 years ago

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.

seriema commented 10 years ago

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

ceoaliongroo commented 10 years ago

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

seriema commented 10 years ago

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

seriema commented 10 years ago

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.

seriema commented 10 years ago

@ceoaliongroo are you still interested in doing this?

ceoaliongroo commented 10 years ago

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

seriema commented 10 years ago

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

ceoaliongroo commented 10 years ago

yes the new version, angularjs 1.3

seriema commented 10 years ago

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

seriema commented 10 years ago

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