Skip to content

Commit f7e33da

Browse files
author
Mark Powney
committed
spo-listitem-get updated tests for access tokens and connections
1 parent 48b85fc commit f7e33da

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

src/o365/spo/commands/listitem/listitem-get.spec.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ describe(commands.LISTITEM_GET, () => {
1414
let vorpal: Vorpal;
1515
let log: any[];
1616
let cmdInstance: any;
17-
let cmdInstanceLogSpy: sinon.SinonSpy;
1817
let trackEvent: any;
1918
let telemetry: any;
2019

@@ -68,7 +67,6 @@ describe(commands.LISTITEM_GET, () => {
6867
log.push(msg);
6968
}
7069
};
71-
cmdInstanceLogSpy = sinon.spy(cmdInstance, 'log');
7270
auth.site = new Site();
7371
telemetry = null;
7472
});
@@ -126,9 +124,9 @@ describe(commands.LISTITEM_GET, () => {
126124
auth.site = new Site();
127125
auth.site.connected = false;
128126
cmdInstance.action = command.action();
129-
cmdInstance.action({ options: { debug: false, webUrl: 'https://contoso.sharepoint.com', listTitle: 'Demo List', id: expectedId } }, () => {
127+
cmdInstance.action({ options: { debug: false, webUrl: 'https://contoso.sharepoint.com', listTitle: 'Demo List', id: expectedId } }, (err?: any) => {
130128
try {
131-
assert(cmdInstanceLogSpy.calledWith(new CommandError('Connect to a SharePoint Online site first')));
129+
assert.equal(JSON.stringify(err), JSON.stringify(new CommandError('Connect to a SharePoint Online site first')));
132130
done();
133131
}
134132
catch (e) {
@@ -395,13 +393,14 @@ describe(commands.LISTITEM_GET, () => {
395393
cmdInstance.action = command.action();
396394
cmdInstance.action({
397395
options: {
396+
id: 1,
398397
listId: "BC448D63-484F-49C5-AB8C-96B14AA68D50",
399398
webUrl: "https://contoso.sharepoint.com",
400399
debug: false
401400
}
402-
}, () => {
401+
}, (err?: any) => {
403402
try {
404-
assert(cmdInstanceLogSpy.calledWith(new CommandError('Error getting access token')));
403+
assert.equal(JSON.stringify(err), JSON.stringify(new CommandError('Error getting access token')));
405404
done();
406405
}
407406
catch (e) {

0 commit comments

Comments
 (0)