adopted-ember-addons/ember-data-factory-guy

documention error for returns method for mockCreate and mockUpdate

mtoygar opened this issue · 0 comments

First of all, thank you all for this great addon.

The docs on the README.md mentions a returns method usage with a created_at key for mockCreate. Looks like this suggested usage is no longer valid.

// Exactly matching attributes, and returning extra attributes
  mockCreate('project')
    .match({name: "Moo", user: user})
    .returns({created_at: new Date()});

As far as I see, the options object for the returns method of mockCreate and mockUpdate can only contain attrs and add as a key.

ref: https://github.com/adopted-ember-addons/ember-data-factory-guy/blob/master/addon/mocks/attribute-matcher.js#L80

Other than that, I think add key is also only valid for mockUpdate, looks like mockCreate does not use it.
ref: https://github.com/adopted-ember-addons/ember-data-factory-guy/blob/v3.9.7/addon/mocks/mock-update-request.js#L41
ref: https://github.com/adopted-ember-addons/ember-data-factory-guy/blob/master/addon/mocks/mock-create-request.js#L30

However, add key usage is also not documented if I am not mistaken. Also, when I try to follow the code and understand its usage, I could not understand its purpose. I have guessed that it was the older way of adding meta info with the add method. If I am right, this add option might be removed as well.