Skip to content

Commit ea2652a

Browse files
author
mdrichardson
committed
added confirmPrompt test for null locale
1 parent 3985a06 commit ea2652a

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

libraries/botbuilder-dialogs/tests/confirmPrompt.test.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,41 @@ describe('ConfirmPrompt', function () {
521521
.assertReply(`The result found is 'true'.`);
522522
});
523523

524+
it('should recogize valid number and default to en if locale is null.', async function () {
525+
const adapter = new TestAdapter(async (turnContext) => {
526+
527+
turnContext.activity.locale = null;
528+
529+
const dc = await dialogs.createContext(turnContext);
530+
531+
const results = await dc.continueDialog();
532+
if (results.status === DialogTurnStatus.empty) {
533+
await dc.prompt('prompt', {
534+
prompt: { text: 'Please confirm.', type: ActivityTypes.Message },
535+
retryPrompt: { text: 'Please confirm, say "yes" or "no" or something like that.', type: ActivityTypes.Message }
536+
});
537+
} else if (results.status === DialogTurnStatus.complete) {
538+
await turnContext.sendActivity(`The result found is '${ results.result }'.`);
539+
}
540+
await convoState.saveChanges(turnContext);
541+
});
542+
543+
const convoState = new ConversationState(new MemoryStorage());
544+
545+
const dialogState = convoState.createProperty('dialogState');
546+
const dialogs = new DialogSet(dialogState);
547+
const prompt = new ConfirmPrompt('prompt');
548+
prompt.choiceOptions = { includeNumbers: true };
549+
dialogs.add(prompt);
550+
551+
await adapter.send('Hello')
552+
.assertReply('Please confirm. (1) Yes or (2) No')
553+
.send('lala')
554+
.assertReply('Please confirm, say "yes" or "no" or something like that. (1) Yes or (2) No')
555+
.send('1')
556+
.assertReply(`The result found is 'true'.`);
557+
});
558+
524559
it('should recogize valid number and default to en if locale invalid string.', async function () {
525560
const adapter = new TestAdapter(async (turnContext) => {
526561

0 commit comments

Comments
 (0)