diff --git a/backend/src/schema/resolvers/rooms.spec.ts b/backend/src/schema/resolvers/rooms.spec.ts index a527d1b8b..0978fd600 100644 --- a/backend/src/schema/resolvers/rooms.spec.ts +++ b/backend/src/schema/resolvers/rooms.spec.ts @@ -295,7 +295,7 @@ describe('Room', () => { { id: expect.any(String), roomId: expect.any(String), - roomName: 'Other Chatting User', + roomName: 'Third Chatting User', users: expect.arrayContaining([ { _id: 'chatting-user', @@ -306,9 +306,9 @@ describe('Room', () => { }, }, { - _id: 'other-chatting-user', - id: 'other-chatting-user', - name: 'Other Chatting User', + _id: 'third-chatting-user', + id: 'third-chatting-user', + name: 'Third Chatting User', avatar: { url: expect.any(String), }, @@ -350,7 +350,7 @@ describe('Room', () => { { id: expect.any(String), roomId: expect.any(String), - roomName: 'Third Chatting User', + roomName: 'Other Chatting User', users: expect.arrayContaining([ { _id: 'chatting-user', @@ -361,9 +361,9 @@ describe('Room', () => { }, }, { - _id: 'third-chatting-user', - id: 'third-chatting-user', - name: 'Third Chatting User', + _id: 'other-chatting-user', + id: 'other-chatting-user', + name: 'Other Chatting User', avatar: { url: expect.any(String), }, @@ -395,9 +395,9 @@ describe('Room', () => { data: { Room: [ { - id: result.data.Room[0].id, - roomId: result.data.Room[0].id, - roomName: 'Other Chatting User', + id: expect.any(String), + roomId: expect.any(String), + roomName: 'Third Chatting User', users: expect.arrayContaining([ { _id: 'chatting-user', @@ -408,9 +408,9 @@ describe('Room', () => { }, }, { - _id: 'other-chatting-user', - id: 'other-chatting-user', - name: 'Other Chatting User', + _id: 'third-chatting-user', + id: 'third-chatting-user', + name: 'Third Chatting User', avatar: { url: expect.any(String), }, diff --git a/webapp/graphql/Rooms.js b/webapp/graphql/Rooms.js index 38fd5e3b1..a746d34f9 100644 --- a/webapp/graphql/Rooms.js +++ b/webapp/graphql/Rooms.js @@ -2,7 +2,7 @@ import gql from 'graphql-tag' export const roomQuery = () => gql` query Room($first: Int, $offset: Int, $id: ID) { - Room(first: $first, offset: $offset, id: $id) { + Room(first: $first, offset: $offset, id: $id, orderBy: createdAt_desc) { id roomId roomName