Skip to content

Commit

Permalink
add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Yen Truong committed Sep 10, 2024
1 parent a717e0a commit e5f8ac5
Show file tree
Hide file tree
Showing 4 changed files with 137 additions and 316 deletions.
5 changes: 2 additions & 3 deletions packages/chat-core-zendesk/jest.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
"moduleFileExtensions": ["js", "ts", "d.ts"],
"moduleDirectories": ["node_modules", "<rootDir>"],
"testEnvironment": "jsdom",
"testPathIgnorePatterns": ["./tests/mocks/*", "./tests/jest-setup.js"],
"testPathIgnorePatterns": ["./tests/mocks/*"],
"resetMocks": true,
"testMatch": ["<rootDir>/tests/**/*.[jt]s"],
"setupFiles": ["<rootDir>/tests/jest-setup.js"]
"testMatch": ["<rootDir>/tests/**/*.[jt]s"]
}
6 changes: 4 additions & 2 deletions packages/chat-core-zendesk/src/infra/ChatCoreZendeskImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,16 @@ export class ChatCoreZendeskImpl {
[MetadataChatSDKKey]: true,
}
});
console.log('Smooch: convo', convo)
this.conversationId = convo.id
Smooch.loadConversation(convo.id);
Smooch.sendMessage(messageRsp.notes.conversationSummary ?? "User requested agent assistance", this.conversationId);
Smooch.sendMessage(`SUMMARY: ${messageRsp.notes.conversationSummary}` ?? "User requested agent assistance", this.conversationId);
}

private setupEventListeners() {
Smooch.on('message:received', (message: Message, data: ConversationData) => {
if (message.type !== 'text') {
return;
}
// If the message is from a bot, indicating the agent has left or closed the ticket, then reset the session
if (message.role === 'business' &&
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
Expand Down
Loading

0 comments on commit e5f8ac5

Please sign in to comment.