-
-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
testHelper handleFindAll cannot handle RESTAdapter relationships #113
Comments
hmm .. interesting .. I wonder why the tests were passing for the REST adapter .. I will investigate further .. ( do I have relationship test for them? ( not sure? ) ) but I am doing big refactor of the json responses right now, so this issue might be fixable in this refactor if I can get a failing test. |
Huh, interestingly, it seems to work if the relationship fields are defined with |
That is kinda interesting .. I will factor that in when testing .. man .. that is going to be another whopper, testing sync and async for everything .. I am doing alittle bit now .. but for everything .. gulp .. |
I think it works because your test helper builds the models and adds them to the store. When the request is made, the async fields are ignored. When they are looked up, they already exist in the store, so ED does not make another network request. |
I don't think that is correct .. but feel free to slap some code in here to prove me wrong. handleFindAll: function () {
var args = Array.prototype.slice.call(arguments);
var modelName = args.shift();
var json = FactoryGuy.buildList.apply(FactoryGuy, arguments);
var responseJson;
if (!FactoryGuy.useJSONAPI()) {
responseJson = this.mapFindAll(modelName, json);
} else {
responseJson = json;
}
var url = this.buildURL(modelName);
this.stubEndpointForHttpRequest(url, responseJson);
}, All this is doing is building json and returning it in mockjax call |
Ah yeah, buildList not makeList... Looking again at my test, I see that the template does not render related model properties. |
So, is that a nice failure case that I can bank on? |
@FilmKnurd , I am working on this one now. Boy, this is such a good issue. |
@FilmKnurd , finally got this one .. ( v2.0.1 ) Let me know if there are any problems. This was a big nternal refactor, but very very worth it, so thanks for pushing me along. |
All my tests are passing :-) |
It looks like the intent of the testHelper is handle both JSONAPI and other adapters. However, the responseJSON built is incorrect for RESTAdapter relationships.
Currently
But should be
The text was updated successfully, but these errors were encountered: