Snapshot record in any of Store mocks is empty
cinkonaap opened this issue · 3 comments
I've been writing a test for a model with adapter that requires snapshot.record
model instance in multiple urlFor*
methods. I couldn't make it work, because record
was always empty.
After looking at the source code, it seems like this.model
is never set. Maybe I am overlooking something, but still would be glad to discuss and help to fix that.
the => this.model is the model that you are mocking so it might be empty .. it just depends how you do the mock. so if you do
let user = make('user');
mockUpdate(user);
than this.model will be that user you are mocking
whereas if you just do
mockUpdate('user');
this.model will be nil
you are welcome to try and fix it. I just can't think of how to do a fix when you have no real model.
I am using a model created with a make
method, so we are talking about such scenario:
let user = make('user');
mockFindRecord(user);
However, I think model instance is never passed to any of MockRequest
classes (only modelName), so it's not available even if full model is used:
Ok, interesting .. I think you can fix that then. Can you make the PR with the fix ? ( and make a test for that ).