Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Line channel updates #834

Merged
merged 3 commits into from
Apr 3, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions libraries/botbuilder-dialogs/src/choices/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const channels: any = {
facebook: 'facebook',
groupme: 'groupme',
kik: 'kik',
line: 'line',
msteams: 'msteams',
skype: 'skype',
skypeforbusiness: 'skypeforbusiness',
Expand All @@ -38,6 +39,8 @@ export function supportsSuggestedActions(channelId: string, buttonCnt: number =
case channels.facebook:
case channels.skype:
return (buttonCnt <= 10);
case channels.line:
return (buttonCnt <= 13);
case channels.kik:
return (buttonCnt <= 20);
case channels.slack:
Expand All @@ -62,6 +65,8 @@ export function supportsCardActions(channelId: string, buttonCnt: number = 100):
case channels.skype:
case channels.msteams:
return (buttonCnt <= 3);
case channels.line:
return (buttonCnt <= 99);
case channels.slack:
case channels.emulator:
case channels.directline:
Expand Down
44 changes: 37 additions & 7 deletions libraries/botbuilder-dialogs/tests/choices_channel.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,73 @@ const { supportsSuggestedActions, supportsCardActions, hasMessageFeed, getChanne
describe('channel methods', function() {
this.timeout(5000);

it(`should return true for supportsCardActions() with skype and 10`, function () {
it(`should return true for supportsSuggestedActions() with line and 13`, function () {
const validNumOfSuggestedActions = supportsSuggestedActions('line', 13);
assert(validNumOfSuggestedActions, `returned false.`);
});

it(`should return false for supportsSuggestedActions() with line and 14`, function () {
const validNumOfSuggestedActions = supportsSuggestedActions('line', 14);
assert(validNumOfSuggestedActions === false, `returned true.`);
});

it(`should return true for supportsSuggestedActions() with skype and 10`, function () {
const validNumOfSuggestedActions = supportsSuggestedActions('skype', 10);
assert(validNumOfSuggestedActions, `returned false.`);
});

it(`should return false for supportsCardActions() with skype and 11`, function () {
it(`should return false for supportsSuggestedActions() with skype and 11`, function () {
const validNumOfSuggestedActions = supportsSuggestedActions('skype', 11);
assert(validNumOfSuggestedActions === false, `returned true.`);
});

it(`should return true for supportsCardActions() with kik and 20`, function () {
it(`should return true for supportsSuggestedActions() with skype and 10`, function () {
const validNumOfSuggestedActions = supportsSuggestedActions('skype', 10);
assert(validNumOfSuggestedActions, `returned false.`);
});

it(`should return false for supportsSuggestedActions() with skype and 11`, function () {
const validNumOfSuggestedActions = supportsSuggestedActions('skype', 11);
assert(validNumOfSuggestedActions === false, `returned true.`);
});

it(`should return true for supportsSuggestedActions() with kik and 20`, function () {
const validNumOfSuggestedActions = supportsSuggestedActions('kik', 20);
assert(validNumOfSuggestedActions, `returned false.`);
});

it(`should return false for supportsCardActions() with kik and 21`, function () {
it(`should return false for supportsSuggestedActions() with kik and 21`, function () {
const validNumOfSuggestedActions = supportsSuggestedActions('kik', 21);
assert(validNumOfSuggestedActions === false, `returned true.`);
});

it(`should return true for supportsCardActions() with emulator and 100`, function () {
it(`should return true for supportsSuggestedActions() with emulator and 100`, function () {
const validNumOfSuggestedActions = supportsSuggestedActions('emulator', 100);
assert(validNumOfSuggestedActions, `returned false.`);
});

it(`should return false for supportsCardActions() with emulator and 101`, function () {
it(`should return false for supportsSuggestedActions() with emulator and 101`, function () {
const validNumOfSuggestedActions = supportsSuggestedActions('emulator', 101);
assert(validNumOfSuggestedActions === false, `returned true.`);
});

it(`should return true for supportsCardActions() with line and 99`, function () {
const validNumOfCardActions = supportsCardActions('line', 99);
assert(validNumOfCardActions, `returned false.`);
});

it(`should return false for supportsCardActions() with line and 100`, function () {
const validNumOfCardActions = supportsCardActions('line', 100);
assert(validNumOfCardActions === false, `returned false.`);
});

it(`should return true for supportsCardActions() with cortana and 100`, function () {
const validNumOfCardActions = supportsCardActions('cortana', 100);
assert(validNumOfCardActions, `returned false.`);
});

it(`should return false for supportsCardActions() with slack and 101`, function () {
const validNumOfCardActions = supportsCardActions('cortana', 101);
const validNumOfCardActions = supportsCardActions('slack', 101);
assert(validNumOfCardActions === false, `returned true.`);
});

Expand Down