-
Notifications
You must be signed in to change notification settings - Fork 324
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
155056e
commit ac30a5c
Showing
2 changed files
with
45 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -383,6 +383,41 @@ describe(commands.O365GROUP_GET, () => { | |
})); | ||
}); | ||
|
||
it('throws error if retrieved group is not a M365 group', async () => { | ||
const groupId = '1caf7dcd-7e83-4c3a-94f7-932a1299c844'; | ||
sinon.stub(request, 'get').callsFake(async (opts) => { | ||
if (opts.url === `https://graph.microsoft.com/v1.0/groups/1caf7dcd-7e83-4c3a-94f7-932a1299c844`) { | ||
return { | ||
"id": groupId, | ||
"deletedDateTime": null, | ||
"classification": null, | ||
"createdDateTime": "2017-11-29T03:27:05Z", | ||
"description": "This is the Contoso Finance Group. Please come here and check out the latest news, posts, files, and more.", | ||
"displayName": "Finance", | ||
"groupTypes": [], | ||
"mail": "[email protected]", | ||
"mailEnabled": true, | ||
"mailNickname": "finance", | ||
"onPremisesLastSyncDateTime": null, | ||
"onPremisesProvisioningErrors": [], | ||
"onPremisesSecurityIdentifier": null, | ||
"onPremisesSyncEnabled": null, | ||
"preferredDataLocation": null, | ||
"proxyAddresses": [ | ||
"SMTP:[email protected]" | ||
], | ||
"renewedDateTime": "2017-11-29T03:27:05Z", | ||
"securityEnabled": false, | ||
"visibility": "Public" | ||
}; | ||
} | ||
|
||
throw 'Invalid request'; | ||
}); | ||
|
||
await assert.rejects(command.action(logger, { options: { id: groupId } }), new CommandError(`Specified group with id '${groupId}' is not a Microsoft 365 group.`)); | ||
}); | ||
|
||
it('handles random API error', async () => { | ||
const errorMessage = 'Something went wrong'; | ||
sinon.stub(request, 'get').rejects(new Error(errorMessage)); | ||
|
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