Skip to content
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

documention error for returns method for mockCreate and mockUpdate #430

Open
mtoygar opened this issue Dec 10, 2020 · 0 comments
Open

documention error for returns method for mockCreate and mockUpdate #430

mtoygar opened this issue Dec 10, 2020 · 0 comments

Comments

@mtoygar
Copy link

mtoygar commented Dec 10, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant