mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
expect specific order of elements when querying, fix pagination query
This commit is contained in:
parent
bb509ae244
commit
06b15dcd5c
@ -13,8 +13,8 @@ export const createMessageMutation = () => {
|
||||
|
||||
export const messageQuery = () => {
|
||||
return gql`
|
||||
query ($roomId: ID!) {
|
||||
Message(roomId: $roomId) {
|
||||
query ($roomId: ID!, $first: Int, $offset: Int) {
|
||||
Message(roomId: $roomId, first: $first, offset: $offset, orderBy: createdAt_desc) {
|
||||
_id
|
||||
id
|
||||
indexId
|
||||
|
||||
@ -254,7 +254,7 @@ describe('Message', () => {
|
||||
).resolves.toMatchObject({
|
||||
errors: undefined,
|
||||
data: {
|
||||
Message: expect.arrayContaining([
|
||||
Message: [
|
||||
expect.objectContaining({
|
||||
id: expect.any(String),
|
||||
indexId: '0',
|
||||
@ -282,7 +282,7 @@ describe('Message', () => {
|
||||
avatar: expect.any(String),
|
||||
date: expect.any(String),
|
||||
}),
|
||||
]),
|
||||
],
|
||||
},
|
||||
})
|
||||
})
|
||||
@ -295,22 +295,12 @@ describe('Message', () => {
|
||||
roomId,
|
||||
first: 2,
|
||||
offset: 0,
|
||||
orderBy: 'created_desc',
|
||||
},
|
||||
}),
|
||||
).resolves.toMatchObject({
|
||||
errors: undefined,
|
||||
data: {
|
||||
Message: expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
id: expect.any(String),
|
||||
indexId: '0',
|
||||
content: 'Some nice message to other chatting user',
|
||||
senderId: 'chatting-user',
|
||||
username: 'Chatting User',
|
||||
avatar: expect.any(String),
|
||||
date: expect.any(String),
|
||||
}),
|
||||
Message: [
|
||||
expect.objectContaining({
|
||||
id: expect.any(String),
|
||||
indexId: '1',
|
||||
@ -320,7 +310,16 @@ describe('Message', () => {
|
||||
avatar: expect.any(String),
|
||||
date: expect.any(String),
|
||||
}),
|
||||
]),
|
||||
expect.objectContaining({
|
||||
id: expect.any(String),
|
||||
indexId: '2',
|
||||
content: 'And another nice message to other chatting user',
|
||||
senderId: 'chatting-user',
|
||||
username: 'Chatting User',
|
||||
avatar: expect.any(String),
|
||||
date: expect.any(String),
|
||||
}),
|
||||
],
|
||||
},
|
||||
})
|
||||
|
||||
@ -331,23 +330,22 @@ describe('Message', () => {
|
||||
roomId,
|
||||
first: 2,
|
||||
offset: 2,
|
||||
orderBy: 'created_desc',
|
||||
},
|
||||
}),
|
||||
).resolves.toMatchObject({
|
||||
errors: undefined,
|
||||
data: {
|
||||
Message: expect.arrayContaining([
|
||||
Message: [
|
||||
expect.objectContaining({
|
||||
id: expect.any(String),
|
||||
indexId: '2',
|
||||
content: 'And another nice message to other chatting user',
|
||||
indexId: '0',
|
||||
content: 'Some nice message to other chatting user',
|
||||
senderId: 'chatting-user',
|
||||
username: 'Chatting User',
|
||||
avatar: expect.any(String),
|
||||
date: expect.any(String),
|
||||
}),
|
||||
]),
|
||||
],
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user