@@ -18,6 +18,7 @@ import command, { options } from './calendargroup-remove.js';
1818describe ( commands . CALENDARGROUP_REMOVE , ( ) => {
1919 const calendarGroupId = 'AAMkAGE0MGM1Y2M5LWEzMmUtNGVlNy05MjRlLTk0YmYyY2I5NTM3ZAAuAAAAAAC_0WfqSjt_SqLtNkuO-bj1AQAbfYq5lmBxQ6a4t1fGbeYAAAAAAEOAAA=' ;
2020 const calendarGroupName = 'Personal Events' ;
21+ const currentUserId = '2b4097f3-5b17-4153-a8b4-cd680e333555' ;
2122 const userId = 'b743445a-112c-4fda-9afd-05943f9c7b36' ;
2223 const userName = 'john.doe@contoso.com' ;
2324
@@ -61,12 +62,14 @@ describe(commands.CALENDARGROUP_REMOVE, () => {
6162 return Promise . resolve ( false ) ;
6263 } ) ;
6364 sinon . stub ( accessToken , 'isAppOnlyAccessToken' ) . returns ( false ) ;
65+ sinon . stub ( accessToken , 'getUserIdFromAccessToken' ) . returns ( currentUserId ) ;
6466 promptIssued = false ;
6567 } ) ;
6668
6769 afterEach ( ( ) => {
6870 sinonUtil . restore ( [
6971 accessToken . isAppOnlyAccessToken ,
72+ accessToken . getUserIdFromAccessToken ,
7073 calendarGroup . getUserCalendarGroupByName ,
7174 request . get ,
7275 request . delete ,
@@ -152,7 +155,7 @@ describe(commands.CALENDARGROUP_REMOVE, () => {
152155
153156 it ( 'removes the calendar group specified by id for the signed-in user without prompting' , async ( ) => {
154157 const deleteRequestStub = sinon . stub ( request , 'delete' ) . callsFake ( async ( opts ) => {
155- if ( opts . url === `https://graph.microsoft.com/v1.0/me /calendarGroups/${ calendarGroupId } ` ) {
158+ if ( opts . url === `https://graph.microsoft.com/v1.0/users(' ${ currentUserId } ') /calendarGroups/${ calendarGroupId } ` ) {
156159 return ;
157160 }
158161
@@ -165,7 +168,7 @@ describe(commands.CALENDARGROUP_REMOVE, () => {
165168
166169 it ( 'removes the calendar group specified by id for the signed-in user (verbose)' , async ( ) => {
167170 const deleteRequestStub = sinon . stub ( request , 'delete' ) . callsFake ( async ( opts ) => {
168- if ( opts . url === `https://graph.microsoft.com/v1.0/me /calendarGroups/${ calendarGroupId } ` ) {
171+ if ( opts . url === `https://graph.microsoft.com/v1.0/users(' ${ currentUserId } ') /calendarGroups/${ calendarGroupId } ` ) {
169172 return ;
170173 }
171174
@@ -180,7 +183,7 @@ describe(commands.CALENDARGROUP_REMOVE, () => {
180183 sinon . stub ( calendarGroup , 'getUserCalendarGroupByName' ) . resolves ( { id : calendarGroupId , name : calendarGroupName } ) ;
181184
182185 const deleteRequestStub = sinon . stub ( request , 'delete' ) . callsFake ( async ( opts ) => {
183- if ( opts . url === `https://graph.microsoft.com/v1.0/me /calendarGroups/${ calendarGroupId } ` ) {
186+ if ( opts . url === `https://graph.microsoft.com/v1.0/users(' ${ currentUserId } ') /calendarGroups/${ calendarGroupId } ` ) {
184187 return ;
185188 }
186189
@@ -198,7 +201,7 @@ describe(commands.CALENDARGROUP_REMOVE, () => {
198201 sinon . stub ( calendarGroup , 'getUserCalendarGroupByName' ) . resolves ( { id : calendarGroupId , name : calendarGroupName } ) ;
199202
200203 const deleteRequestStub = sinon . stub ( request , 'delete' ) . callsFake ( async ( opts ) => {
201- if ( opts . url === `https://graph.microsoft.com/v1.0/me /calendarGroups/${ calendarGroupId } ` ) {
204+ if ( opts . url === `https://graph.microsoft.com/v1.0/users(' ${ currentUserId } ') /calendarGroups/${ calendarGroupId } ` ) {
202205 return ;
203206 }
204207
0 commit comments