tests/Add-SkylineWebPart.Tests.ps1
Describe "Add-SkylineWebPart" { BeforeAll { } Context "upload a new webpart to the webpart gallery" { It "should upload a new webpart" { Add-SkylineWebPart -Path .\assets\ContentEditor.dwp -Group "Tests" } It "should have uploaded the new webpart named ContentEditor.webpart" { Get-PnPFile -Url "_catalogs/wp/ContentEditor.dwp" -AsString -ErrorAction SilentlyContinue | Should Not BeNullOrEmpty } It "should have set the web part group to 'Tests'" { $WebPartItem = Get-PnPFile -Url "_catalogs/wp/ContentEditor.dwp" -AsListItem -ErrorAction SilentlyContinue $WebPartItem["Group"] | Should Be "Tests" } } AfterAll { Remove-PnPFile -SiteRelativeUrl "_catalogs/wp/ContentEditor.dwp" -Force } } |