You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So when I try to use mockCreate().match() with a relationship, the type key is getting pluralized in the expected data and the match fails because our serializer does not pluralize the type key.
@cristinawithout .. good point here.
Do you think you could put together a PR that would handle this ??
and put a nice test together ( which would be pretty similar to what you have above ) ??
Our application serializer has the following method that purposely does not pluralize.
payloadKeyFromModelName(modelName) { return Ember.String.underscore(modelName); }
mock-create-request.js is setting serializeMode to true and jsonapi-fixture-converter.js uses that to pluralize the type.
So when I try to use mockCreate().match() with a relationship, the type key is getting pluralized in the expected data and the match fails because our serializer does not pluralize the type key.
Example:
mockCreate('entry-type').match({name: 'My Name', handle: 'my_name', section: {id: '1', type: 'section'}})
And when it reaches this comparison, the data is:
expectedData.data:
requestData.data:
So the match fails, but the requestData is exactly as it should be using our serializer.
Is it possible to instead lookup serializers by modelName and use payloadKeyFromModelName() as the JSONAPI serializer does when serializing the type?
The text was updated successfully, but these errors were encountered: