-
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
05cab2f
commit eddb54e
Showing
4 changed files
with
88 additions
and
39 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 |
---|---|---|
|
@@ -13,8 +13,7 @@ import { pid } from '../../../../utils/pid'; | |
import { session } from '../../../../utils/session'; | ||
import { sinonUtil } from '../../../../utils/sinonUtil'; | ||
import commands from '../../commands'; | ||
import * as spoFileSharingLinkListCommand from './file-sharinglink-list'; | ||
import { GraphFileDetails } from '../../../../utils/spo'; | ||
import { GraphFileDetails, spo } from '../../../../utils/spo'; | ||
const command: Command = require('./file-sharinglink-clear'); | ||
|
||
describe(commands.FILE_SHARINGLINK_CLEAR, () => { | ||
|
@@ -27,10 +26,6 @@ describe(commands.FILE_SHARINGLINK_CLEAR, () => { | |
VroomItemID: '01A5WCPNXHFAS23ZNOF5D3XU2WU7S3I2AU' | ||
}; | ||
const sharingLink = { "id": "8c2c9168-7d3d-4119-bcab-3c5340ce603b", "roles": ["read"], "hasPassword": false, "grantedToIdentitiesV2": [{ "group": { "displayName": "h Members", "email": "[email protected]", "id": "94da1e01-bbab-41e9-b9a4-4595c5805a6b" }, "siteUser": { "displayName": "h Members", "email": "[email protected]", "id": "428", "loginName": "c:0o.c|federateddirectoryclaimprovider|94da1e01-bbab-41e9-b9a4-4595c5805a6b" } }], "grantedToIdentities": [{ "user": { "displayName": "h Members", "email": "[email protected]", "id": "94da1e01-bbab-41e9-b9a4-4595c5805a6b" } }], "link": { "scope": "anonymous", "type": "view", "webUrl": "https://contoso.sharepoint.com/:b:/s/pnpcoresdktestgroup/EY50lub3559MtRKfj2hrZqoBea_L-lv1lND19RSCJGtWNg", "preventsDownload": false } }; | ||
const sharingLinksListCommandResponse = { | ||
"stdout": JSON.stringify([sharingLink]), | ||
"stderr": "" | ||
}; | ||
|
||
let log: any[]; | ||
let logger: Logger; | ||
|
@@ -71,7 +66,7 @@ describe(commands.FILE_SHARINGLINK_CLEAR, () => { | |
request.delete, | ||
request.get, | ||
Cli.prompt, | ||
Cli.executeCommandWithOutput | ||
spo.getFileSharingLinks | ||
]); | ||
}); | ||
|
||
|
@@ -147,12 +142,7 @@ describe(commands.FILE_SHARINGLINK_CLEAR, () => { | |
throw 'Invalid request'; | ||
}); | ||
|
||
sinon.stub(Cli, 'executeCommandWithOutput').callsFake(async (command): Promise<any> => { | ||
if (command === spoFileSharingLinkListCommand) { | ||
return sharingLinksListCommandResponse; | ||
} | ||
throw 'Error occured while executing the command.'; | ||
}); | ||
sinon.stub(spo, 'getFileSharingLinks').resolves([sharingLink]); | ||
|
||
const deleteStub = sinon.stub(request, 'delete').callsFake(async (opts) => { | ||
if (opts.url === `https://graph.microsoft.com/v1.0/sites/${fileInformationResponse.SiteId}/drives/${fileInformationResponse.VroomDriveID}/items/${fileInformationResponse.VroomItemID}/permissions/${sharingLink.id}`) { | ||
|
@@ -178,12 +168,7 @@ describe(commands.FILE_SHARINGLINK_CLEAR, () => { | |
throw 'Invalid request'; | ||
}); | ||
|
||
sinon.stub(Cli, 'executeCommandWithOutput').callsFake(async (command): Promise<any> => { | ||
if (command === spoFileSharingLinkListCommand) { | ||
return sharingLinksListCommandResponse; | ||
} | ||
throw 'Error occured while executing the command.'; | ||
}); | ||
sinon.stub(spo, 'getFileSharingLinks').resolves([sharingLink]); | ||
|
||
const deleteStub = sinon.stub(request, 'delete').callsFake(async (opts) => { | ||
if (opts.url === `https://graph.microsoft.com/v1.0/sites/${fileInformationResponse.SiteId}/drives/${fileInformationResponse.VroomDriveID}/items/${fileInformationResponse.VroomItemID}/permissions/${sharingLink.id}`) { | ||
|
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