Skip to content

Commit

Permalink
fix: getSuggestionsCard() to set card title (#3488)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevengum authored Mar 30, 2021
1 parent da81f32 commit 7163531
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions libraries/botbuilder-ai/src/qnaCardBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ export class QnACardBuilder {
title: cardNoMatchText,
});

const promptsCard = CardFactory.heroCard('', undefined, buttonList);
const message = MessageFactory.attachment(promptsCard, cardTitle);
const promptsCard = CardFactory.heroCard(cardTitle, undefined, buttonList);
const message = MessageFactory.attachment(promptsCard);

return message;
}
Expand Down
6 changes: 4 additions & 2 deletions libraries/botbuilder-ai/tests/qnaMakerDialog.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,14 +277,15 @@ describe('QnAMakerDialog', function () {
const convoState = new ConversationState(new MemoryStorage());
const dm = new DialogManager();
dm.conversationState = convoState;
const activeLearningCardTitle = 'Suggested questions';
const cardNoMatchText = 'Not helpful.';
const qnaDialog = new QnAMakerDialog(
kbId,
endpointKey,
HOSTNAME,
undefined,
undefined,
undefined,
activeLearningCardTitle,
cardNoMatchText
);

Expand All @@ -300,8 +301,9 @@ describe('QnAMakerDialog', function () {
strictEqual(reply.attachments && reply.attachments.length, 1);
strictEqual(reply.attachments[0].contentType, CardFactory.contentTypes.heroCard);

// Verify the suggestions match the values received from QnA Maker.
const heroCard = reply.attachments[0].content;
strictEqual(heroCard.title, activeLearningCardTitle);
// Verify the suggestions match the values received from QnA Maker.
strictEqual(heroCard.buttons.length, 4);

for (let idx = 0; idx < heroCard.buttons.length; idx++) {
Expand Down

0 comments on commit 7163531

Please sign in to comment.