Skip to content

Commit

Permalink
fix: failing test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
disha1202 committed Oct 21, 2024
1 parent 2d82877 commit cd9bf98
Showing 1 changed file with 83 additions and 23 deletions.
106 changes: 83 additions & 23 deletions src/components/UserPortal/ChatRoom/ChatRoom.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ const MESSAGE_SENT_TO_CHAT_MOCK = [
_id: '1',
},
messageContent: 'Test ',
type: 'STRING',
replyTo: null,
sender: {
_id: '64378abd85008f171cf2990d',
Expand Down Expand Up @@ -79,7 +78,6 @@ const MESSAGE_SENT_TO_CHAT_MOCK = [
_id: '1',
},
replyTo: null,
type: 'STRING',
sender: {
_id: '64378abd85008f171cf2990d',
firstName: 'Wilt',
Expand Down Expand Up @@ -108,7 +106,6 @@ const MESSAGE_SENT_TO_CHAT_MOCK = [
_id: '1',
},
replyTo: null,
type: 'STRING',
sender: {
_id: '64378abd85008f171cf2990d',
firstName: 'Wilt',
Expand Down Expand Up @@ -153,7 +150,6 @@ const CHAT_BY_ID_QUERY_MOCK = [
createdAt: '345678908765',
messageContent: 'Hello',
replyTo: null,
type: 'STRING',
sender: {
_id: '2',
firstName: 'Test',
Expand Down Expand Up @@ -213,7 +209,6 @@ const CHAT_BY_ID_QUERY_MOCK = [
createdAt: '345678908765',
messageContent: 'Hello',
replyTo: null,
type: 'STRING',
sender: {
_id: '2',
firstName: 'Test',
Expand Down Expand Up @@ -273,7 +268,6 @@ const CHAT_BY_ID_QUERY_MOCK = [
createdAt: '345678908765',
messageContent: 'Hello',
replyTo: null,
type: 'STRING',
sender: {
_id: '2',
firstName: 'Test',
Expand Down Expand Up @@ -340,7 +334,6 @@ const CHATS_LIST_MOCK = [
createdAt: '345678908765',
messageContent: 'Hello',
replyTo: null,
type: 'STRING',
sender: {
_id: '2',
firstName: 'Test',
Expand Down Expand Up @@ -412,7 +405,6 @@ const CHATS_LIST_MOCK = [
createdAt: '345678908765',
messageContent: 'Hello',
replyTo: null,
type: 'STRING',
sender: {
_id: '2',
firstName: 'Test',
Expand Down Expand Up @@ -498,7 +490,6 @@ const CHATS_LIST_MOCK = [
createdAt: '345678908765',
messageContent: 'Hello',
replyTo: null,
type: 'STRING',
sender: {
_id: '2',
firstName: 'Test',
Expand Down Expand Up @@ -570,7 +561,6 @@ const CHATS_LIST_MOCK = [
createdAt: '345678908765',
messageContent: 'Hello',
replyTo: null,
type: 'STRING',
sender: {
_id: '2',
firstName: 'Test',
Expand Down Expand Up @@ -656,7 +646,6 @@ const CHATS_LIST_MOCK = [
createdAt: '345678908765',
messageContent: 'Hello',
replyTo: null,
type: 'STRING',
sender: {
_id: '2',
firstName: 'Test',
Expand Down Expand Up @@ -728,7 +717,6 @@ const CHATS_LIST_MOCK = [
createdAt: '345678908765',
messageContent: 'Hello',
replyTo: null,
type: 'STRING',
sender: {
_id: '2',
firstName: 'Test',
Expand Down Expand Up @@ -816,7 +804,6 @@ const GROUP_CHAT_BY_ID_QUERY_MOCK = [
createdAt: '345678908765',
messageContent: 'Hello',
replyTo: null,
type: 'STRING',
sender: {
_id: '2',
firstName: 'Test',
Expand Down Expand Up @@ -900,7 +887,6 @@ const GROUP_CHAT_BY_ID_QUERY_MOCK = [
createdAt: '345678908765',
messageContent: 'Hello',
replyTo: null,
type: 'STRING',
sender: {
_id: '2',
firstName: 'Test',
Expand Down Expand Up @@ -984,7 +970,6 @@ const GROUP_CHAT_BY_ID_QUERY_MOCK = [
createdAt: '345678908765',
messageContent: 'Hello',
replyTo: null,
type: 'STRING',
sender: {
_id: '2',
firstName: 'Test',
Expand Down Expand Up @@ -1038,14 +1023,94 @@ const GROUP_CHAT_BY_ID_QUERY_MOCK = [
];

const SEND_MESSAGE_TO_CHAT_MOCK = [
{
request: {
query: SEND_MESSAGE_TO_CHAT,
variables: {
"chatId": "1",
"replyTo": "4",
"messageContent": "Test reply message"
}
},
result: {
data: {
sendMessageToChat: {
_id: '668ec1f1364e03ac47a151',
createdAt: '2024-07-10T17:16:33.248Z',
messageContent: 'Test ',
replyTo: null,
sender: {
_id: '64378abd85008f171cf2990d',
firstName: 'Wilt',
lastName: 'Shepherd',
image: '',
},
updatedAt: '2024-07-10',
},
},
},
},
{
request: {
query: SEND_MESSAGE_TO_CHAT,
variables: {
"chatId": "1",
"replyTo": "4",
"messageContent": "Test reply message"
}
},
result: {
data: {
sendMessageToChat: {
_id: '668ec1f1364e03ac47a151',
createdAt: '2024-07-10T17:16:33.248Z',
messageContent: 'Test ',
replyTo: null,
sender: {
_id: '64378abd85008f171cf2990d',
firstName: 'Wilt',
lastName: 'Shepherd',
image: '',
},
updatedAt: '2024-07-10',
},
},
},
},
{
request: {
query: SEND_MESSAGE_TO_CHAT,
variables: {
"chatId": "1",
"replyTo": "1",
"messageContent": "Test reply message"
}
},
result: {
data: {
sendMessageToChat: {
_id: '668ec1f1364e03ac47a151',
createdAt: '2024-07-10T17:16:33.248Z',
messageContent: 'Test ',
replyTo: null,
sender: {
_id: '64378abd85008f171cf2990d',
firstName: 'Wilt',
lastName: 'Shepherd',
image: '',
},
updatedAt: '2024-07-10',
},
},
},
},
{
request: {
query: SEND_MESSAGE_TO_CHAT,
variables: {
chatId: '1',
replyTo: undefined,
messageContent: 'Hello',
type: 'STRING',
},
},
result: {
Expand All @@ -1054,7 +1119,6 @@ const SEND_MESSAGE_TO_CHAT_MOCK = [
_id: '668ec1f1364e03ac47a151',
createdAt: '2024-07-10T17:16:33.248Z',
messageContent: 'Test ',
type: 'STRING',
replyTo: null,
sender: {
_id: '64378abd85008f171cf2990d',
Expand All @@ -1074,7 +1138,6 @@ const SEND_MESSAGE_TO_CHAT_MOCK = [
chatId: '1',
replyTo: '345678',
messageContent: 'Test reply message',
type: 'STRING',
},
},
result: {
Expand All @@ -1083,7 +1146,6 @@ const SEND_MESSAGE_TO_CHAT_MOCK = [
_id: '668ec1f1364e03ac47a151',
createdAt: '2024-07-10T17:16:33.248Z',
messageContent: 'Test ',
type: 'STRING',
replyTo: null,
sender: {
_id: '64378abd85008f171cf2990d',
Expand All @@ -1103,7 +1165,6 @@ const SEND_MESSAGE_TO_CHAT_MOCK = [
chatId: '1',
replyTo: undefined,
messageContent: 'Test message',
type: 'STRING',
},
},
result: {
Expand All @@ -1112,7 +1173,6 @@ const SEND_MESSAGE_TO_CHAT_MOCK = [
_id: '668ec1f1364e03ac47a151',
createdAt: '2024-07-10T17:16:33.248Z',
messageContent: 'Test ',
type: 'STRING',
replyTo: null,
sender: {
_id: '64378abd85008f171cf2990d',
Expand Down Expand Up @@ -1216,7 +1276,7 @@ describe('Testing Chatroom Component [User Portal]', () => {
expect(input.value).toBeFalsy();
});

const messages = await screen.findAllByTestId('directChatMsg');
const messages = await screen.findAllByTestId('message');

console.log('MESSAGES', messages);

Expand Down Expand Up @@ -1301,7 +1361,7 @@ describe('Testing Chatroom Component [User Portal]', () => {
expect(input.value).toBeFalsy();
});

const messages = await screen.findAllByTestId('directChatMsg');
const messages = await screen.findAllByTestId('message');

console.log('MESSAGES', messages);

Expand Down

0 comments on commit cd9bf98

Please sign in to comment.