-
Notifications
You must be signed in to change notification settings - Fork 281
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add getMeetingInfo to TeamsInfo (#3738)
- Loading branch information
1 parent
a8731af
commit ec197fe
Showing
9 changed files
with
361 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -661,6 +661,100 @@ describe('TeamsInfo', function () { | |
}); | ||
}); | ||
|
||
describe('getMeetingInfo', function () { | ||
const context = new TestContext(teamActivity); | ||
|
||
it('should work with correct arguments-meetingId in context', async function () { | ||
const details = { | ||
organizer: { | ||
id: teamActivity.from.id, | ||
name: teamActivity.from.name, | ||
objectId: 'User-One-Object-Id', | ||
givenName: 'User', | ||
surname: 'One', | ||
email: '[email protected]', | ||
userPrincipalName: '[email protected]', | ||
tenantId: teamActivity.conversation.tenantId, | ||
}, | ||
details: { | ||
id: 'meeting-id', | ||
msGraphResourceId: 'msGraph-id', | ||
scheduledStartTime: new Date('Thu Jun 10 2021 15:02:32 GMT-0700'), | ||
scheduledEndTime: new Date('Thu Jun 10 2021 16:02:32 GMT-0700'), | ||
joinUrl: 'https://teams.microsoft.com/l/meetup-join/someEncodedMeetingString', | ||
title: 'Fake meeting', | ||
type: 'Scheduled', | ||
}, | ||
conversation: { | ||
id: teamActivity.conversation.id, | ||
}, | ||
}; | ||
|
||
const { expectedAuthHeader, expectation: fetchOauthToken } = nockOauth(); | ||
|
||
const fetchExpectation = nock('https://smba.trafficmanager.net/amer') | ||
.get('/v1/meetings/19%3AmeetingId') | ||
.matchHeader('Authorization', expectedAuthHeader) | ||
.reply(200, details); | ||
|
||
const fetchedDetails = await TeamsInfo.getMeetingInfo(context); | ||
|
||
assert(fetchOauthToken.isDone()); | ||
assert(fetchExpectation.isDone()); | ||
|
||
assert.deepStrictEqual(fetchedDetails, details); | ||
}); | ||
|
||
it('should work with correct arguments-meetingId passed in', async function () { | ||
const details = { | ||
organizer: { | ||
id: teamActivity.from.id, | ||
name: teamActivity.from.name, | ||
objectId: 'User-One-Object-Id', | ||
givenName: 'User', | ||
surname: 'One', | ||
email: '[email protected]', | ||
userPrincipalName: '[email protected]', | ||
tenantId: teamActivity.conversation.tenantId, | ||
}, | ||
details: { | ||
id: 'meeting-id', | ||
msGraphResourceId: 'msGraph-id', | ||
scheduledStartTime: new Date('Thu Jun 10 2021 15:02:32 GMT-0700'), | ||
scheduledEndTime: new Date('Thu Jun 10 2021 16:02:32 GMT-0700'), | ||
joinUrl: 'https://teams.microsoft.com/l/meetup-join/someEncodedMeetingString', | ||
title: 'Fake meeting', | ||
type: 'Scheduled', | ||
}, | ||
conversation: { | ||
id: teamActivity.conversation.id, | ||
}, | ||
}; | ||
|
||
const { expectedAuthHeader, expectation: fetchOauthToken } = nockOauth(); | ||
|
||
const fetchExpectation = nock('https://smba.trafficmanager.net/amer') | ||
.get('/v1/meetings/meeting-id') | ||
.matchHeader('Authorization', expectedAuthHeader) | ||
.reply(200, details); | ||
|
||
const fetchedDetails = await TeamsInfo.getMeetingInfo(context, details.details.id); | ||
|
||
assert(fetchOauthToken.isDone()); | ||
assert(fetchExpectation.isDone()); | ||
|
||
assert.deepStrictEqual(fetchedDetails, details); | ||
}); | ||
|
||
it('should throw error for missing context', async function () { | ||
await assert.rejects(TeamsInfo.getMeetingInfo(), Error('context is required.')); | ||
}); | ||
|
||
it('should throw error for missing meetingId', async function () { | ||
await assert.rejects(TeamsInfo.getMeetingInfo({ activity: {} }), Error('meetingId or TurnContext containing meetingId is required.')); | ||
}); | ||
}); | ||
|
||
describe('getTeamMembers()', function () { | ||
it('should error in 1-on-1 chat', async function () { | ||
const context = new TestContext(oneOnOneActivity); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.