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

drop teams specific send #1347

Merged
merged 2 commits into from
Oct 23, 2019
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 0 additions & 1 deletion libraries/botbuilder/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@ export * from './inspectionMiddleware';
export * from './teamsActivityHandler';
export * from './teamsActivityHelpers';
export * from './teamsInfo';
export * from './teamsTurnContextHelpers';
export * from 'botbuilder-core';
58 changes: 0 additions & 58 deletions libraries/botbuilder/src/teamsTurnContextHelpers.ts

This file was deleted.

88 changes: 1 addition & 87 deletions libraries/botbuilder/tests/teamsHelpers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ const sinon = require('sinon');

const {
BotFrameworkAdapter,
teamsCreateConversation,
teamsGetChannelId,
teamsGetTeamId,
teamsNotifyUser,
teamsSendToGeneralChannel
teamsNotifyUser
} = require('../');


Expand Down Expand Up @@ -129,90 +127,6 @@ describe('TeamsActivityHelpers method', function() {
});
});

describe('TeamsTurnContextHelpers method', () => {
describe('teamsCreateConversation()', () => {
it('should error with no teamsChannelId', function(done) {
const context = new TestContext(createActivityNoTeamId());

teamsCreateConversation(context, null, createActivityNoTeamId())
.then(result => {
done(new Error('teamsCreateConversation() should have thrown an error'));
})
.catch((error) => {
assert.strictEqual(error.message, 'Missing valid teamsChannelId argument');
done();
});
});

it('should error with no activity', function(done) {
const context = new TestContext(createActivityNoTeamId());

teamsCreateConversation(context, 'msteams', null)
.then(result => {
done(new Error('teamsCreateConversation() should have thrown an error'));
})
.catch((error) => {
assert.strictEqual(error.message, 'Missing valid message argument');
done();
});
});

it('should get results from teamsCreateConversation', async function() {
const context = new TestContext(createActivityNoTeamId());

const result = await teamsCreateConversation(context, 'mycrazyteamschannel', createActivityNoTeamId());

assert(result);
assert.strictEqual(result.length, 2);
assert(result[0]);
assert(result[1]);
assert.strictEqual(result[1], 'MYACTIVITYID');
assert.strictEqual(result[0].activityId, 1);
assert.strictEqual(result[0].conversation.id, 'MyCreationId');
assert.strictEqual(result[0].channelId, 'teams');
});
});

describe('teamsSendToGeneralChannel()', () => {
it('should error with no teamId', function(done) {
const context = new TestContext(createActivityNoTeamId());

teamsSendToGeneralChannel(context, null, createActivityNoTeamId())
.then(result => {
done(new Error('teamsSendToGeneralChannel() should have thrown an error'));
})
.catch(error => {
assert.strictEqual(error.message, 'The current Activity was not sent from a Teams Team.');
done();
});
});

it('should error with no activity', async function() {
const context = new TestContext(createActivityNoTeamId());

await teamsSendToGeneralChannel(context, 'msteams', null).catch((error) => {
assert.strictEqual(error.message, 'The current Activity was not sent from a Teams Team.');
});
});

it('should get results', async function() {
const context = new TestContext(createActivityTeamId());

const result = await teamsSendToGeneralChannel(context, 'mycrazyteamschannel', createActivityTeamId());

assert(result);
assert.strictEqual(result.length, 2);
assert(result[0]);
assert(result[1]);
assert.strictEqual(result[1], 'MYACTIVITYID');
assert.strictEqual(result[0].activityId, 1);
assert.strictEqual(result[0].conversation.id, 'MyCreationId');
assert.strictEqual(result[0].channelId, 'teams');
});
});
})


function createActivityNoTeamId() {
return {
type: 'message',
Expand Down