mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
add chat middleware to add new message subscription
This commit is contained in:
parent
33ecc4764e
commit
eed89f8c4b
@ -54,4 +54,7 @@ export default {
|
||||
Mutation: {
|
||||
CreateRoom: roomProperties,
|
||||
},
|
||||
Subscription: {
|
||||
chatMessageAdded: messageProperties,
|
||||
},
|
||||
}
|
||||
|
||||
@ -117,7 +117,7 @@ describe('Message', () => {
|
||||
})
|
||||
|
||||
describe('user chats in room', () => {
|
||||
it('returns the message and publishes subscription', async () => {
|
||||
it('returns the message and publishes subscriptions', async () => {
|
||||
await expect(
|
||||
mutate({
|
||||
mutation: createMessageMutation(),
|
||||
@ -146,6 +146,20 @@ describe('Message', () => {
|
||||
roomCountUpdated: '1',
|
||||
userId: 'other-chatting-user',
|
||||
})
|
||||
expect(pubsubSpy).toBeCalledWith('CHAT_MESSAGE_ADDED', {
|
||||
chatMessageAdded: expect.objectContaining({
|
||||
id: expect.any(String),
|
||||
content: 'Some nice message to other chatting user',
|
||||
senderId: 'chatting-user',
|
||||
username: 'Chatting User',
|
||||
avatar: expect.any(String),
|
||||
date: expect.any(String),
|
||||
saved: true,
|
||||
distributed: false,
|
||||
seen: false,
|
||||
}),
|
||||
userId: 'other-chatting-user',
|
||||
})
|
||||
})
|
||||
|
||||
describe('room is updated as well', () => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user