@@ -8,7 +8,7 @@ describe("Admin", function () {
88 // let propertyId = "";
99
1010 // Ensure we have the data to test against
11- before ( async function ( ) {
11+ before ( async function ( ) {
1212
1313 if ( ! this . pnp . settings . enableWebTests || stringIsNullOrEmpty ( this . pnp . settings . testUser ) ) {
1414 this . skip ( ) ;
@@ -36,36 +36,36 @@ describe("Admin", function () {
3636 } ) ;
3737
3838 describe ( "SharePoint" , function ( ) {
39- it ( "Get SharePoint Settings" , pnpTest ( "923c1bd6-8621-41d2-9ea9-004a4a735c9f" , async function ( ) {
39+ it ( "Get SharePoint Settings" , pnpTest ( "923c1bd6-8621-41d2-9ea9-004a4a735c9f" , async function ( ) {
4040 const sharePointSettings = await this . pnp . graph . admin . sharepoint . settings ( ) ;
4141 return expect ( sharePointSettings . availableManagedPathsForSiteCreation . length > 0 ) . is . true ;
4242 } ) ) ;
4343
44- it ( "Update SharePoint Settings" , pnpTest ( "bbf52535-3a7e-452b-b0eb-9940832163aa" , async function ( ) {
44+ it ( "Update SharePoint Settings" , pnpTest ( "bbf52535-3a7e-452b-b0eb-9940832163aa" , async function ( ) {
4545 const sharePointSettings = await this . pnp . graph . admin . sharepoint . settings . update ( { deletedUserPersonalSiteRetentionPeriodInDays : 30 } ) ;
4646 return expect ( sharePointSettings . deletedUserPersonalSiteRetentionPeriodInDays === 30 ) . is . true ;
4747 } ) ) ;
4848 } ) ;
4949
5050 describe ( "People" , function ( ) {
51- it ( "Get People Settings" , pnpTest ( "9bd5a022-65d3-4a34-b8c4-c74381b98551" , async function ( ) {
51+ it ( "Get People Settings" , pnpTest ( "9bd5a022-65d3-4a34-b8c4-c74381b98551" , async function ( ) {
5252 const settings = await this . pnp . graph . admin . people ( ) ;
5353 return expect ( settings . profileCardProperties ) . is . not . null ;
5454 } ) ) ;
5555
56- it ( "Get Pronoun Settings" , pnpTest ( "bbc0e5af-3620-4164-9120-556ac534db39" , async function ( ) {
56+ it ( "Get Pronoun Settings" , pnpTest ( "bbc0e5af-3620-4164-9120-556ac534db39" , async function ( ) {
5757 const settings = await this . pnp . graph . admin . people . pronounSettings ( ) ;
5858 return expect ( settings . isEnabledInOrganization ) . to . be . an ( "boolean" ) ;
5959 } ) ) ;
6060
61- it . skip ( "Update Pronoun Settings" , pnpTest ( "830c2b41-5642-40d6-8585-3e26207e3f13" , async function ( ) {
61+ it . skip ( "Update Pronoun Settings" , pnpTest ( "830c2b41-5642-40d6-8585-3e26207e3f13" , async function ( ) {
6262 const settings = await this . pnp . graph . admin . people . pronounSettings . update ( {
6363 isEnabledInOrganization : true ,
6464 } ) ;
6565 return expect ( settings . isEnabledInOrganization ) . is . true ;
6666 } ) ) ;
6767
68- it . skip ( "Add Profile Card Property" , pnpTest ( "49b98899-0af3-4b8b-8f66-3748410420b7" , async function ( ) {
68+ it . skip ( "Add Profile Card Property" , pnpTest ( "49b98899-0af3-4b8b-8f66-3748410420b7" , async function ( ) {
6969 const property = await this . pnp . graph . admin . people . profileCardProperties . add ( {
7070 directoryPropertyName : "CustomAttribute2" ,
7171 annotations : [ {
@@ -81,12 +81,12 @@ describe("Admin", function () {
8181 return expect ( property . id ) . is . not . null ;
8282 } ) ) ;
8383
84- it . skip ( "Get Profile Card Property" , pnpTest ( "05d8f50a-1b47-4631-9576-2aa3c5efcf75" , async function ( ) {
84+ it . skip ( "Get Profile Card Property" , pnpTest ( "05d8f50a-1b47-4631-9576-2aa3c5efcf75" , async function ( ) {
8585 const property = await this . pnp . graph . admin . people . profileCardProperties . getById ( customUserProperty ) ( ) ;
8686 return expect ( property . id ) . is . not . null ;
8787 } ) ) ;
8888
89- it . skip ( "Update Profile Card Property" , pnpTest ( "04fb914e-41c6-4b8e-a326-63c41e6672a4" , async function ( ) {
89+ it . skip ( "Update Profile Card Property" , pnpTest ( "04fb914e-41c6-4b8e-a326-63c41e6672a4" , async function ( ) {
9090 const displayName = getRandomString ( 5 ) + "Cost Center" ;
9191 const property = await this . pnp . graph . admin . people . profileCardProperties . getById ( customUserProperty ) . update ( {
9292 directoryPropertyName : this . customUserProperty ,
@@ -103,7 +103,7 @@ describe("Admin", function () {
103103 return expect ( property . annotations [ 0 ] ?. displayName ) . equals ( displayName ) ;
104104 } ) ) ;
105105
106- it . skip ( "Delete Profile Card Property" , pnpTest ( "fbfae956-d776-4bd7-8ad2-3db384ec02c3" , async function ( ) {
106+ it . skip ( "Delete Profile Card Property" , pnpTest ( "fbfae956-d776-4bd7-8ad2-3db384ec02c3" , async function ( ) {
107107 const property = await this . pnp . graph . admin . people . profileCardProperties . add ( {
108108 directoryPropertyName : getRandomString ( 5 ) + "CustomAttribute2" ,
109109 annotations : [ {
@@ -122,55 +122,62 @@ describe("Admin", function () {
122122 } ) ;
123123
124124 describe ( "Service Health" , function ( ) {
125- it ( "Get Health Overviews" , pnpTest ( "79f7392b-053d-44a0-87f6-a1c2332d6841" , async function ( ) {
125+ it ( "Get Health Overviews" , pnpTest ( "79f7392b-053d-44a0-87f6-a1c2332d6841" , async function ( ) {
126126 const healthOverviews = await this . pnp . graph . admin . serviceAnnouncements . healthOverviews ( ) ;
127127 return expect ( healthOverviews ) . to . be . an ( "array" ) ;
128128 } ) ) ;
129129
130- it ( "Get Health By Service Name" , pnpTest ( "f06cd76b-3a61-4728-ba5e-f97bb6e718a8" , async function ( ) {
130+ it ( "Get Health By Service Name" , pnpTest ( "f06cd76b-3a61-4728-ba5e-f97bb6e718a8" , async function ( ) {
131131 const serviceHealth = await this . pnp . graph . admin . serviceAnnouncements . healthOverviews . getByName ( "Microsoft 365 suite" ) ( ) ;
132132 return expect ( serviceHealth ) . has . property ( "id" ) ;
133133 } ) ) ;
134134
135- it ( "Get Health Issues" , pnpTest ( "6b04e99e-dcbb-48ee-87c2-4d17b1fad12d" , async function ( ) {
135+ it ( "Get Health Issues" , pnpTest ( "6b04e99e-dcbb-48ee-87c2-4d17b1fad12d" , async function ( ) {
136136 const issues = await this . pnp . graph . admin . serviceAnnouncements . issues ( ) ;
137137 return expect ( issues ) . to . be . an ( "array" ) ;
138138 } ) ) ;
139139
140- it ( "Get Health Messages" , pnpTest ( "d06cd76b-3a61-4728-ba5e-f97bb6e718a8" , async function ( ) {
140+ it ( "Get Health Messages" , pnpTest ( "d06cd76b-3a61-4728-ba5e-f97bb6e718a8" , async function ( ) {
141141 const messages = await this . pnp . graph . admin . serviceAnnouncements . messages ( ) ;
142142 return expect ( messages ) . to . be . an ( "array" ) ;
143143 } ) ) ;
144144
145- it ( "Get Health Message by ID" , pnpTest ( "2cc3edd5-b7af-4967-b8b4-840d161f1b61" , async function ( ) {
145+ it ( "Get Health Message by ID" , pnpTest ( "2cc3edd5-b7af-4967-b8b4-840d161f1b61" , async function ( ) {
146146 const messages = await this . pnp . graph . admin . serviceAnnouncements . messages ( ) ;
147- if ( messages . length > 0 ) {
147+ if ( messages . length > 0 ) {
148148 const messageById = await this . pnp . graph . admin . serviceAnnouncements . messages . getById ( messages [ 0 ] ?. id ) ( ) ;
149149 return expect ( messageById ) . is . not . null ;
150- } else {
150+ } else {
151151 console . log ( "No messages to test" ) ;
152152 return true ;
153153 }
154154 } ) ) ;
155155
156- it ( "Get Health Message Attachments" , pnpTest ( "2e26b2a1-5ce8-4cf9-a0dc-4decddba5641" , async function ( ) {
156+ it ( "Get Health Message Attachments" , pnpTest ( "2e26b2a1-5ce8-4cf9-a0dc-4decddba5641" , async function ( ) {
157157 const messages = await this . pnp . graph . admin . serviceAnnouncements . messages ( ) ;
158158
159159 const attachments = await this . pnp . graph . admin . serviceAnnouncements . messages . getById ( messages [ 0 ] ?. id ) . attachments ( ) ;
160160 return expect ( attachments ) . to . be . an ( "array" ) ;
161161 } ) ) ;
162162
163- it ( "Get Health Message Attachments by Id" , pnpTest ( "2cef2a70-31c9-4180-91bf-f0bab86e3501" , async function ( ) {
163+ it ( "Get Health Message Attachments by Id" , pnpTest ( "2cef2a70-31c9-4180-91bf-f0bab86e3501" , async function ( ) {
164164 const messages = await this . pnp . graph . admin . serviceAnnouncements . messages ( ) ;
165- const attachments = await this . pnp . graph . admin . serviceAnnouncements . messages . getById ( messages [ 0 ] ?. id ) . attachments ( ) ;
166- const attachmentById = await this . pnp . graph . admin . serviceAnnouncements . messages . getById ( attachments [ 0 ] ?. id ) ( ) ;
167-
168- return expect ( attachmentById ) . is . ok ;
165+ if ( messages . length > 0 ) {
166+ const attachments = await this . pnp . graph . admin . serviceAnnouncements . messages . getById ( messages [ 0 ] ?. id ) . attachments ( ) ;
167+ if ( attachments . length > 0 ) {
168+ const attachmentById = await this . pnp . graph . admin . serviceAnnouncements . messages . getById ( attachments [ 0 ] ?. id ) ( ) ;
169+ return expect ( attachmentById ) . is . ok ;
170+ } else {
171+ return true ;
172+ }
173+ } else {
174+ return true ;
175+ }
169176 } ) ) ;
170177 } ) ;
171178
172179
173- after ( async function ( ) {
180+ after ( async function ( ) {
174181
175182 // Only needed when profile card properties can be created with application permissions
176183 // if (!stringIsNullOrEmpty(propertyId)) {
0 commit comments