@@ -187,6 +187,263 @@ describe(commands.LIST_GET, () => {
187187 } ) ;
188188 } ) ;
189189
190+ it ( 'retrieves details of list if title and properties option is passed' , ( done ) => {
191+ sinon . stub ( request , 'get' ) . callsFake ( ( ) => {
192+ return Promise . resolve (
193+ {
194+ "AllowContentTypes" : true ,
195+ "BaseTemplate" : 109 ,
196+ "BaseType" : 1 ,
197+ "ContentTypesEnabled" : false ,
198+ "CrawlNonDefaultViews" : false ,
199+ "Created" : null ,
200+ "CurrentChangeToken" : null ,
201+ "CustomActionElements" : null ,
202+ "DefaultContentApprovalWorkflowId" : "00000000-0000-0000-0000-000000000000" ,
203+ "DefaultItemOpenUseListSetting" : false ,
204+ "Description" : "" ,
205+ "Direction" : "none" ,
206+ "DocumentTemplateUrl" : null ,
207+ "DraftVersionVisibility" : 0 ,
208+ "EnableAttachments" : false ,
209+ "EnableFolderCreation" : true ,
210+ "EnableMinorVersions" : false ,
211+ "EnableModeration" : false ,
212+ "EnableVersioning" : false ,
213+ "EntityTypeName" : "Documents" ,
214+ "ExemptFromBlockDownloadOfNonViewableFiles" : false ,
215+ "FileSavePostProcessingEnabled" : false ,
216+ "ForceCheckout" : false ,
217+ "HasExternalDataSource" : false ,
218+ "Hidden" : false ,
219+ "Id" : "14b2b6ed-0885-4814-bfd6-594737cc3ae3" ,
220+ "ImagePath" : null ,
221+ "ImageUrl" : null ,
222+ "IrmEnabled" : false ,
223+ "IrmExpire" : false ,
224+ "IrmReject" : false ,
225+ "IsApplicationList" : false ,
226+ "IsCatalog" : false ,
227+ "IsPrivate" : false ,
228+ "ItemCount" : 69 ,
229+ "LastItemDeletedDate" : null ,
230+ "LastItemModifiedDate" : null ,
231+ "LastItemUserModifiedDate" : null ,
232+ "ListExperienceOptions" : 0 ,
233+ "ListItemEntityTypeFullName" : null ,
234+ "MajorVersionLimit" : 0 ,
235+ "MajorWithMinorVersionsLimit" : 0 ,
236+ "MultipleDataList" : false ,
237+ "NoCrawl" : false ,
238+ "ParentWebPath" : null ,
239+ "ParentWebUrl" : null ,
240+ "ParserDisabled" : false ,
241+ "ServerTemplateCanCreateFolders" : true ,
242+ "TemplateFeatureId" : null ,
243+ "Title" : "Documents"
244+ }
245+ ) ;
246+ //}
247+ //return Promise.reject('Invalid request');
248+ } ) ;
249+
250+ command . action ( logger , {
251+ options : {
252+ debug : true ,
253+ title : 'Documents' ,
254+ webUrl : 'https://contoso.sharepoint.com' ,
255+ properties :'Title,Id'
256+ }
257+ } , ( ) => {
258+ try {
259+ assert ( loggerLogSpy . calledWith ( {
260+ AllowContentTypes : true ,
261+ BaseTemplate : 109 ,
262+ BaseType : 1 ,
263+ ContentTypesEnabled : false ,
264+ CrawlNonDefaultViews : false ,
265+ Created : null ,
266+ CurrentChangeToken : null ,
267+ CustomActionElements : null ,
268+ DefaultContentApprovalWorkflowId : '00000000-0000-0000-0000-000000000000' ,
269+ DefaultItemOpenUseListSetting : false ,
270+ Description : '' ,
271+ Direction : 'none' ,
272+ DocumentTemplateUrl : null ,
273+ DraftVersionVisibility : 0 ,
274+ EnableAttachments : false ,
275+ EnableFolderCreation : true ,
276+ EnableMinorVersions : false ,
277+ EnableModeration : false ,
278+ EnableVersioning : false ,
279+ EntityTypeName : 'Documents' ,
280+ ExemptFromBlockDownloadOfNonViewableFiles : false ,
281+ FileSavePostProcessingEnabled : false ,
282+ ForceCheckout : false ,
283+ HasExternalDataSource : false ,
284+ Hidden : false ,
285+ Id : '14b2b6ed-0885-4814-bfd6-594737cc3ae3' ,
286+ ImagePath : null ,
287+ ImageUrl : null ,
288+ IrmEnabled : false ,
289+ IrmExpire : false ,
290+ IrmReject : false ,
291+ IsApplicationList : false ,
292+ IsCatalog : false ,
293+ IsPrivate : false ,
294+ ItemCount : 69 ,
295+ LastItemDeletedDate : null ,
296+ LastItemModifiedDate : null ,
297+ LastItemUserModifiedDate : null ,
298+ ListExperienceOptions : 0 ,
299+ ListItemEntityTypeFullName : null ,
300+ MajorVersionLimit : 0 ,
301+ MajorWithMinorVersionsLimit : 0 ,
302+ MultipleDataList : false ,
303+ NoCrawl : false ,
304+ ParentWebPath : null ,
305+ ParentWebUrl : null ,
306+ ParserDisabled : false ,
307+ ServerTemplateCanCreateFolders : true ,
308+ TemplateFeatureId : null ,
309+ Title : 'Documents'
310+ } ) ) ;
311+ done ( ) ;
312+ }
313+ catch ( e ) {
314+ done ( e ) ;
315+ }
316+ } ) ;
317+ } ) ;
318+
319+
320+ it ( 'retrieves details of list if list id and properties option is passed' , ( done ) => {
321+ sinon . stub ( request , 'get' ) . callsFake ( ( ) => {
322+ return Promise . resolve (
323+ {
324+ "AllowContentTypes" : true ,
325+ "BaseTemplate" : 109 ,
326+ "BaseType" : 1 ,
327+ "ContentTypesEnabled" : false ,
328+ "CrawlNonDefaultViews" : false ,
329+ "Created" : null ,
330+ "CurrentChangeToken" : null ,
331+ "CustomActionElements" : null ,
332+ "DefaultContentApprovalWorkflowId" : "00000000-0000-0000-0000-000000000000" ,
333+ "DefaultItemOpenUseListSetting" : false ,
334+ "Description" : "" ,
335+ "Direction" : "none" ,
336+ "DocumentTemplateUrl" : null ,
337+ "DraftVersionVisibility" : 0 ,
338+ "EnableAttachments" : false ,
339+ "EnableFolderCreation" : true ,
340+ "EnableMinorVersions" : false ,
341+ "EnableModeration" : false ,
342+ "EnableVersioning" : false ,
343+ "EntityTypeName" : "Documents" ,
344+ "ExemptFromBlockDownloadOfNonViewableFiles" : false ,
345+ "FileSavePostProcessingEnabled" : false ,
346+ "ForceCheckout" : false ,
347+ "HasExternalDataSource" : false ,
348+ "Hidden" : false ,
349+ "Id" : "14b2b6ed-0885-4814-bfd6-594737cc3ae3" ,
350+ "ImagePath" : null ,
351+ "ImageUrl" : null ,
352+ "IrmEnabled" : false ,
353+ "IrmExpire" : false ,
354+ "IrmReject" : false ,
355+ "IsApplicationList" : false ,
356+ "IsCatalog" : false ,
357+ "IsPrivate" : false ,
358+ "ItemCount" : 69 ,
359+ "LastItemDeletedDate" : null ,
360+ "LastItemModifiedDate" : null ,
361+ "LastItemUserModifiedDate" : null ,
362+ "ListExperienceOptions" : 0 ,
363+ "ListItemEntityTypeFullName" : null ,
364+ "MajorVersionLimit" : 0 ,
365+ "MajorWithMinorVersionsLimit" : 0 ,
366+ "MultipleDataList" : false ,
367+ "NoCrawl" : false ,
368+ "ParentWebPath" : null ,
369+ "ParentWebUrl" : null ,
370+ "ParserDisabled" : false ,
371+ "ServerTemplateCanCreateFolders" : true ,
372+ "TemplateFeatureId" : null ,
373+ "Title" : "Documents"
374+ }
375+ ) ;
376+ } ) ;
377+
378+ command . action ( logger , {
379+ options : {
380+ debug : true ,
381+ id : '14b2b6ed-0885-4814-bfd6-594737cc3ae3' ,
382+ webUrl : 'https://contoso.sharepoint.com' ,
383+ properties :'Title,Id'
384+ }
385+ } , ( ) => {
386+ try {
387+ assert ( loggerLogSpy . calledWith ( {
388+ AllowContentTypes : true ,
389+ BaseTemplate : 109 ,
390+ BaseType : 1 ,
391+ ContentTypesEnabled : false ,
392+ CrawlNonDefaultViews : false ,
393+ Created : null ,
394+ CurrentChangeToken : null ,
395+ CustomActionElements : null ,
396+ DefaultContentApprovalWorkflowId : '00000000-0000-0000-0000-000000000000' ,
397+ DefaultItemOpenUseListSetting : false ,
398+ Description : '' ,
399+ Direction : 'none' ,
400+ DocumentTemplateUrl : null ,
401+ DraftVersionVisibility : 0 ,
402+ EnableAttachments : false ,
403+ EnableFolderCreation : true ,
404+ EnableMinorVersions : false ,
405+ EnableModeration : false ,
406+ EnableVersioning : false ,
407+ EntityTypeName : 'Documents' ,
408+ ExemptFromBlockDownloadOfNonViewableFiles : false ,
409+ FileSavePostProcessingEnabled : false ,
410+ ForceCheckout : false ,
411+ HasExternalDataSource : false ,
412+ Hidden : false ,
413+ Id : '14b2b6ed-0885-4814-bfd6-594737cc3ae3' ,
414+ ImagePath : null ,
415+ ImageUrl : null ,
416+ IrmEnabled : false ,
417+ IrmExpire : false ,
418+ IrmReject : false ,
419+ IsApplicationList : false ,
420+ IsCatalog : false ,
421+ IsPrivate : false ,
422+ ItemCount : 69 ,
423+ LastItemDeletedDate : null ,
424+ LastItemModifiedDate : null ,
425+ LastItemUserModifiedDate : null ,
426+ ListExperienceOptions : 0 ,
427+ ListItemEntityTypeFullName : null ,
428+ MajorVersionLimit : 0 ,
429+ MajorWithMinorVersionsLimit : 0 ,
430+ MultipleDataList : false ,
431+ NoCrawl : false ,
432+ ParentWebPath : null ,
433+ ParentWebUrl : null ,
434+ ParserDisabled : false ,
435+ ServerTemplateCanCreateFolders : true ,
436+ TemplateFeatureId : null ,
437+ Title : 'Documents'
438+ } ) ) ;
439+ done ( ) ;
440+ }
441+ catch ( e ) {
442+ done ( e ) ;
443+ }
444+ } ) ;
445+ } ) ;
446+
190447 it ( 'command correctly handles list get reject request' , ( done ) => {
191448 const err = 'Invalid request' ;
192449 sinon . stub ( request , 'get' ) . callsFake ( ( opts ) => {
@@ -267,6 +524,18 @@ describe(commands.LIST_GET, () => {
267524 assert ( containsTypeOption ) ;
268525 } ) ;
269526
527+ it ( 'supports specifying properties' , ( ) => {
528+ const options = command . options ( ) ;
529+ let containsTypeOption = false ;
530+ options . forEach ( o => {
531+ if ( o . option . indexOf ( '--properties' ) > - 1 ) {
532+ containsTypeOption = true ;
533+ }
534+ } ) ;
535+ assert ( containsTypeOption ) ;
536+ } ) ;
537+
538+
270539 it ( 'fails validation if both id and title options are not passed' , ( ) => {
271540 const actual = command . validate ( { options : { webUrl : 'https://contoso.sharepoint.com' } } ) ;
272541 assert . notStrictEqual ( actual , true ) ;
0 commit comments