0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

Fixed invite management tests

no issue

- adjusts mirage config so that we're correctly serializing foreign keys
- our API outputs (and our app code expects) foreign keys for non-embedded resources to be in the format `{relationship_name}_id` but mirage's default REST serializer does not include the `_id` suffix
- tests started failing because c46d04f612 introduced a direct access of the invite->role relationship which Ember Data was not correctly creating when mirage was outputting `role` rather than `role_id`
This commit is contained in:
Kevin Ansfield 2020-01-08 15:36:17 +00:00
parent 516f4212c3
commit bc09a7c4d3

View file

@ -19,6 +19,10 @@ export default RestSerializer.extend({
return underscore(relationship); return underscore(relationship);
}, },
keyForForeignKey(relationshipName) {
return `${underscore(relationshipName)}_id`;
},
serialize(object, request) { serialize(object, request) {
// Ember expects pluralized responses for the post, user, and invite models, // Ember expects pluralized responses for the post, user, and invite models,
// and this shortcut will ensure that those models are pluralized // and this shortcut will ensure that those models are pluralized