mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
add test for room creation with existing user id
This commit is contained in:
parent
66652cf74e
commit
3a95e25e1c
@ -71,6 +71,8 @@ describe('Room', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe('authenticated', () => {
|
describe('authenticated', () => {
|
||||||
|
let roomId: string
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
authenticatedUser = await chattingUser.toJson()
|
authenticatedUser = await chattingUser.toJson()
|
||||||
})
|
})
|
||||||
@ -93,12 +95,14 @@ describe('Room', () => {
|
|||||||
|
|
||||||
describe('user id exists', () => {
|
describe('user id exists', () => {
|
||||||
it('returns the id of the room', async () => {
|
it('returns the id of the room', async () => {
|
||||||
await expect(mutate({
|
const result = await mutate({
|
||||||
mutation: createRoomMutation(),
|
mutation: createRoomMutation(),
|
||||||
variables: {
|
variables: {
|
||||||
userId: 'other-chatting-user',
|
userId: 'other-chatting-user',
|
||||||
},
|
},
|
||||||
})).resolves.toMatchObject({
|
})
|
||||||
|
roomId = result.data.CreateRoom.id
|
||||||
|
await expect(result).toMatchObject({
|
||||||
errors: undefined,
|
errors: undefined,
|
||||||
data: {
|
data: {
|
||||||
CreateRoom: {
|
CreateRoom: {
|
||||||
@ -108,6 +112,24 @@ describe('Room', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('create room with same user id', () => {
|
||||||
|
it('returns the id of the room', async () => {
|
||||||
|
await expect(mutate({
|
||||||
|
mutation: createRoomMutation(),
|
||||||
|
variables: {
|
||||||
|
userId: 'other-chatting-user',
|
||||||
|
},
|
||||||
|
})).resolves.toMatchObject({
|
||||||
|
errors: undefined,
|
||||||
|
data: {
|
||||||
|
CreateRoom: {
|
||||||
|
id: roomId,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user