diff --git a/mirage/serializers/crate-owner-invitation.js b/mirage/serializers/crate-owner-invitation.js index 61c13dd4d0..85ec23bef0 100644 --- a/mirage/serializers/crate-owner-invitation.js +++ b/mirage/serializers/crate-owner-invitation.js @@ -2,7 +2,7 @@ import BaseSerializer from './application'; export default BaseSerializer.extend({ // eslint-disable-next-line ember/avoid-leaking-state-in-ember-objects - include: ['inviter'], + include: ['inviter', 'invitee'], getHashForResource() { let [hash, addToIncludes] = BaseSerializer.prototype.getHashForResource.apply(this, arguments); @@ -15,6 +15,8 @@ export default BaseSerializer.extend({ this._adjust(hash); } + addToIncludes.sort((a, b) => a.id - b.id); + return [hash, addToIncludes]; }, @@ -22,6 +24,8 @@ export default BaseSerializer.extend({ delete hash.id; delete hash.token; + hash.crate_id = Number(hash.crate_id); + let crate = this.schema.crates.find(hash.crate_id); hash.crate_name = crate.name; diff --git a/tests/mirage/me/crate-owner-invitations/list-test.js b/tests/mirage/me/crate-owner-invitations/list-test.js index 82a1e0b10d..6e4116819f 100644 --- a/tests/mirage/me/crate-owner-invitations/list-test.js +++ b/tests/mirage/me/crate-owner-invitations/list-test.js @@ -49,7 +49,7 @@ module('Mirage | GET /api/v1/me/crate_owner_invitations', function (hooks) { assert.deepEqual(await response.json(), { crate_owner_invitations: [ { - crate_id: nanomsg.id, + crate_id: Number(nanomsg.id), crate_name: 'nanomsg', created_at: '2016-12-24T12:34:56Z', invited_by_username: 'janed', @@ -57,7 +57,7 @@ module('Mirage | GET /api/v1/me/crate_owner_invitations', function (hooks) { inviter_id: Number(inviter.id), }, { - crate_id: ember.id, + crate_id: Number(ember.id), crate_name: 'ember-rs', created_at: '2020-12-31T12:34:56Z', invited_by_username: 'wycats', @@ -66,6 +66,13 @@ module('Mirage | GET /api/v1/me/crate_owner_invitations', function (hooks) { }, ], users: [ + { + avatar: user.avatar, + id: Number(user.id), + login: user.login, + name: user.name, + url: user.url, + }, { avatar: 'https://avatars1.githubusercontent.com/u/14631425?v=4', id: Number(inviter.id),