From cb6c0fd50e78f87e27b7166b90f4b7a8c60d4eae Mon Sep 17 00:00:00 2001 From: Tobias Bieniek Date: Thu, 19 Aug 2021 19:17:41 +0200 Subject: [PATCH] mirage/crate-owner-invitation: Sort `users` by `id` --- mirage/serializers/crate-owner-invitation.js | 2 ++ .../mirage/me/crate-owner-invitations/list-test.js | 14 +++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/mirage/serializers/crate-owner-invitation.js b/mirage/serializers/crate-owner-invitation.js index 9bf7fa3ccb..85ec23bef0 100644 --- a/mirage/serializers/crate-owner-invitation.js +++ b/mirage/serializers/crate-owner-invitation.js @@ -15,6 +15,8 @@ export default BaseSerializer.extend({ this._adjust(hash); } + addToIncludes.sort((a, b) => a.id - b.id); + return [hash, addToIncludes]; }, diff --git a/tests/mirage/me/crate-owner-invitations/list-test.js b/tests/mirage/me/crate-owner-invitations/list-test.js index 2ffa2afbd4..6e4116819f 100644 --- a/tests/mirage/me/crate-owner-invitations/list-test.js +++ b/tests/mirage/me/crate-owner-invitations/list-test.js @@ -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), @@ -80,13 +87,6 @@ module('Mirage | GET /api/v1/me/crate_owner_invitations', function (hooks) { name: 'wycats', url: 'https://github.com/wycats', }, - { - avatar: user.avatar, - id: Number(user.id), - login: user.login, - name: user.name, - url: user.url, - }, ], }); });