From 40ff2a0a4ef5c4034818885a97b321517571b7a0 Mon Sep 17 00:00:00 2001 From: rulasg Date: Wed, 12 Feb 2025 08:56:16 +0100 Subject: [PATCH 1/2] Rename RepoHelperTest to Test and update function names accordingly --- .../RepoHelperTest.psd1 => Test/Test.psd1 | 2 +- .../RepoHelperTest.psm1 => Test/Test.psm1 | 2 +- .../private/InvokeCommandMock.ps1 | 0 .../private/parameter.test.helper.ps1 | 0 .../public/RepoIssueTimeTracking.test.ps1 | 26 +++++++++---------- .../public/addRepoIssueComment.test.ps1 | 8 +++--- .../public/getRepoAccess.test.ps1 | 10 +++---- .../public/getRepoAccessInvitation.test.ps1 | 10 +++---- .../public/getRepoAccessTeam.Test.ps1 | 4 +-- .../public/getRepoProperties.test.ps1 | 6 ++--- .../public/getRepoPropertiesSchema.test.ps1 | 6 ++--- .../public/grantRepoAccess.test.ps1 | 6 ++--- .../public/label-add.test.ps1 | 4 +-- .../public/label-delete.test.ps1 | 2 +- .../public/label-get.test.ps1 | 4 +-- .../public/repo-create.test.ps1 | 6 ++--- .../public/repo-search.test.ps1 | 4 +-- {RepoHelperTest => Test}/public/repo-test.ps1 | 2 +- .../public/setRepoPropertiesSuccess.test.ps1 | 4 +-- .../public/syncRepoAccess.test.ps1 | 14 +++++----- .../public/testData/getAccessAllSuccess.json | 0 .../testData/getAccessInvitationsError.json | 0 .../testData/getAccessInvitationsSuccess.json | 0 .../public/testData/getAccessNone.json | 0 .../public/testData/getAccessSuccess.json | 0 .../public/testData/getIssueComments.json | 0 .../public/testData/getIssueComments_2.json | 0 .../getIssueComments_MultiTimesInComment.json | 0 .../getIssueComments_WrongTTFormat.json | 0 .../public/testData/getIssueList.json | 0 .../testData/getRepoInfoNoProperties.json | 0 .../public/testData/getRepoInfoSuccess.json | 0 .../testData/getRepoPropertiesNotFound.json | 0 .../testData/getRepoPropertiesSchema.json | 0 .../getRepoPropertiesSchemaNotFound.json | 0 .../getRepoPropertiesSchemaOneResult.json | 0 .../testData/getUserSuccess_MagnusTim.json | 0 .../testData/getUserSuccess_raulgeu.json | 0 .../testData/getUserSuccess_raulgeukk.json | 0 .../testData/getUserSuccess_rulasg.json | 0 .../public/testData/grantAccessError.json | 0 .../public/testData/grantAccessSuccess.json | 0 .../grantAccessSuccessRaulgeuAdmin.json | 0 .../testData/grantAccessSuccessRulasg.json | 0 .../grantAccessSuccessRulasgAdmin.json | 0 .../testData/setRepoPropertiesNotFound.json | 0 .../testData/testRepoAccessNotFound.json | 0 47 files changed, 60 insertions(+), 60 deletions(-) rename RepoHelperTest/RepoHelperTest.psd1 => Test/Test.psd1 (99%) rename RepoHelperTest/RepoHelperTest.psm1 => Test/Test.psm1 (95%) rename {RepoHelperTest => Test}/private/InvokeCommandMock.ps1 (100%) rename {RepoHelperTest => Test}/private/parameter.test.helper.ps1 (100%) rename {RepoHelperTest => Test}/public/RepoIssueTimeTracking.test.ps1 (94%) rename {RepoHelperTest => Test}/public/addRepoIssueComment.test.ps1 (91%) rename {RepoHelperTest => Test}/public/getRepoAccess.test.ps1 (92%) rename {RepoHelperTest => Test}/public/getRepoAccessInvitation.test.ps1 (91%) rename {RepoHelperTest => Test}/public/getRepoAccessTeam.Test.ps1 (98%) rename {RepoHelperTest => Test}/public/getRepoProperties.test.ps1 (89%) rename {RepoHelperTest => Test}/public/getRepoPropertiesSchema.test.ps1 (93%) rename {RepoHelperTest => Test}/public/grantRepoAccess.test.ps1 (94%) rename {RepoHelperTest => Test}/public/label-add.test.ps1 (97%) rename {RepoHelperTest => Test}/public/label-delete.test.ps1 (92%) rename {RepoHelperTest => Test}/public/label-get.test.ps1 (91%) rename {RepoHelperTest => Test}/public/repo-create.test.ps1 (93%) rename {RepoHelperTest => Test}/public/repo-search.test.ps1 (88%) rename {RepoHelperTest => Test}/public/repo-test.ps1 (77%) rename {RepoHelperTest => Test}/public/setRepoPropertiesSuccess.test.ps1 (94%) rename {RepoHelperTest => Test}/public/syncRepoAccess.test.ps1 (95%) rename {RepoHelperTest => Test}/public/testData/getAccessAllSuccess.json (100%) rename {RepoHelperTest => Test}/public/testData/getAccessInvitationsError.json (100%) rename {RepoHelperTest => Test}/public/testData/getAccessInvitationsSuccess.json (100%) rename {RepoHelperTest => Test}/public/testData/getAccessNone.json (100%) rename {RepoHelperTest => Test}/public/testData/getAccessSuccess.json (100%) rename {RepoHelperTest => Test}/public/testData/getIssueComments.json (100%) rename {RepoHelperTest => Test}/public/testData/getIssueComments_2.json (100%) rename {RepoHelperTest => Test}/public/testData/getIssueComments_MultiTimesInComment.json (100%) rename {RepoHelperTest => Test}/public/testData/getIssueComments_WrongTTFormat.json (100%) rename {RepoHelperTest => Test}/public/testData/getIssueList.json (100%) rename {RepoHelperTest => Test}/public/testData/getRepoInfoNoProperties.json (100%) rename {RepoHelperTest => Test}/public/testData/getRepoInfoSuccess.json (100%) rename {RepoHelperTest => Test}/public/testData/getRepoPropertiesNotFound.json (100%) rename {RepoHelperTest => Test}/public/testData/getRepoPropertiesSchema.json (100%) rename {RepoHelperTest => Test}/public/testData/getRepoPropertiesSchemaNotFound.json (100%) rename {RepoHelperTest => Test}/public/testData/getRepoPropertiesSchemaOneResult.json (100%) rename {RepoHelperTest => Test}/public/testData/getUserSuccess_MagnusTim.json (100%) rename {RepoHelperTest => Test}/public/testData/getUserSuccess_raulgeu.json (100%) rename {RepoHelperTest => Test}/public/testData/getUserSuccess_raulgeukk.json (100%) rename {RepoHelperTest => Test}/public/testData/getUserSuccess_rulasg.json (100%) rename {RepoHelperTest => Test}/public/testData/grantAccessError.json (100%) rename {RepoHelperTest => Test}/public/testData/grantAccessSuccess.json (100%) rename {RepoHelperTest => Test}/public/testData/grantAccessSuccessRaulgeuAdmin.json (100%) rename {RepoHelperTest => Test}/public/testData/grantAccessSuccessRulasg.json (100%) rename {RepoHelperTest => Test}/public/testData/grantAccessSuccessRulasgAdmin.json (100%) rename {RepoHelperTest => Test}/public/testData/setRepoPropertiesNotFound.json (100%) rename {RepoHelperTest => Test}/public/testData/testRepoAccessNotFound.json (100%) diff --git a/RepoHelperTest/RepoHelperTest.psd1 b/Test/Test.psd1 similarity index 99% rename from RepoHelperTest/RepoHelperTest.psd1 rename to Test/Test.psd1 index f3b5809..9026e8f 100644 --- a/RepoHelperTest/RepoHelperTest.psd1 +++ b/Test/Test.psd1 @@ -9,7 +9,7 @@ @{ # Script module or binary module file associated with this manifest. -RootModule = 'RepoHelperTest.psm1' +RootModule = 'Test.psm1' # Version number of this module. ModuleVersion = '0.0.1' diff --git a/RepoHelperTest/RepoHelperTest.psm1 b/Test/Test.psm1 similarity index 95% rename from RepoHelperTest/RepoHelperTest.psm1 rename to Test/Test.psm1 index 1d43155..4b67387 100644 --- a/RepoHelperTest/RepoHelperTest.psm1 +++ b/Test/Test.psm1 @@ -26,7 +26,7 @@ Foreach($import in @($Public + $Private)) # Export Public functions ($Public.BaseName) for WIP modules # Set variables visible to the module and its functions only -Export-ModuleMember -Function RepoHelperTest_* +Export-ModuleMember -Function Test_* # Disable calling dependencies # This requires that all dependecies are called through mocks diff --git a/RepoHelperTest/private/InvokeCommandMock.ps1 b/Test/private/InvokeCommandMock.ps1 similarity index 100% rename from RepoHelperTest/private/InvokeCommandMock.ps1 rename to Test/private/InvokeCommandMock.ps1 diff --git a/RepoHelperTest/private/parameter.test.helper.ps1 b/Test/private/parameter.test.helper.ps1 similarity index 100% rename from RepoHelperTest/private/parameter.test.helper.ps1 rename to Test/private/parameter.test.helper.ps1 diff --git a/RepoHelperTest/public/RepoIssueTimeTracking.test.ps1 b/Test/public/RepoIssueTimeTracking.test.ps1 similarity index 94% rename from RepoHelperTest/public/RepoIssueTimeTracking.test.ps1 rename to Test/public/RepoIssueTimeTracking.test.ps1 index abfac39..b5cfcdc 100644 --- a/RepoHelperTest/public/RepoIssueTimeTracking.test.ps1 +++ b/Test/public/RepoIssueTimeTracking.test.ps1 @@ -1,5 +1,5 @@ -function RepoHelperTest_AddRepoIssueTimeTracking_SUCCESS +function Test_AddRepoIssueTimeTracking_SUCCESS { Reset-InvokeCommandMock @@ -12,7 +12,7 @@ function RepoHelperTest_AddRepoIssueTimeTracking_SUCCESS # https://github.com/rulasgorg/repo1/issues/1#issuecomment-1936046674 Assert-IsTrue -Condition ($result.StartsWith("https://github.com/$owner/$repo/issues/$issue#issuecomment-")) } -function RepoHelperTest_AddRepoIssueTimeTracking_WrongTimeFormat +function Test_AddRepoIssueTimeTracking_WrongTimeFormat { Reset-InvokeCommandMock @@ -29,7 +29,7 @@ function RepoHelperTest_AddRepoIssueTimeTracking_WrongTimeFormat Assert-Contains -Expected "Wrong time format [$wrongTime]" -Presented $errorvar.Exception.Message } -function RepoHelperTest_AddRepoIssueTimeTracking_SUCCESS_With_NoCheckBox +function Test_AddRepoIssueTimeTracking_SUCCESS_With_NoCheckBox { Reset-InvokeCommandMock @@ -43,7 +43,7 @@ function RepoHelperTest_AddRepoIssueTimeTracking_SUCCESS_With_NoCheckBox Assert-IsTrue -Condition ($result.StartsWith("https://github.com/$owner/$repo/issues/$issue#issuecomment-")) } -function RepoHelperTest_AddRepoIssueTimeTracking_SUCCESS_NoOwnerRepo +function Test_AddRepoIssueTimeTracking_SUCCESS_NoOwnerRepo { Reset-InvokeCommandMock @@ -58,7 +58,7 @@ function RepoHelperTest_AddRepoIssueTimeTracking_SUCCESS_NoOwnerRepo Assert-IsTrue -Condition ($result.StartsWith("https://github.com/$owner/$repo/issues/$issue#issuecomment-")) } -function RepoHelperTest_GetRepoIssueTimeTracking_SUCCESS +function Test_GetRepoIssueTimeTracking_SUCCESS { Reset-InvokeCommandMock @@ -79,7 +79,7 @@ function RepoHelperTest_GetRepoIssueTimeTracking_SUCCESS Assert-AreEqual -Expected "https://github.com/$owner/$repo/issues/$issue" -Presented $result.Url } -function RepoHelperTest_GetRepoIssueTimeTracking_SUCCESS_SeveralTimesInSingleComment +function Test_GetRepoIssueTimeTracking_SUCCESS_SeveralTimesInSingleComment { Reset-InvokeCommandMock @@ -102,7 +102,7 @@ function RepoHelperTest_GetRepoIssueTimeTracking_SUCCESS_SeveralTimesInSingleCom } -function RepoHelperTest_GetRepoIssueTimeTracking_WrongFormat +function Test_GetRepoIssueTimeTracking_WrongFormat { Reset-InvokeCommandMock @@ -123,7 +123,7 @@ function RepoHelperTest_GetRepoIssueTimeTracking_WrongFormat Assert-AreEqual -Expected $expectedJson -Presented $json } -function RepoHelperTest_GetRepoIssueTimeTracking_Notfound +function Test_GetRepoIssueTimeTracking_Notfound { Reset-InvokeCommandMock @@ -139,7 +139,7 @@ function RepoHelperTest_GetRepoIssueTimeTracking_Notfound } -function RepoHelperTest_GetRepoIssueTimeTracking_Pipe +function Test_GetRepoIssueTimeTracking_Pipe { Reset-InvokeCommandMock @@ -182,7 +182,7 @@ function RepoHelperTest_GetRepoIssueTimeTracking_Pipe Assert-AreEqual -Presented $issue.Total -Expected "10h 33m" } -function RepoHelperTest_GetRepoIssueTimeTrackingRecords_Pipe +function Test_GetRepoIssueTimeTrackingRecords_Pipe { Reset-InvokeCommandMock @@ -276,7 +276,7 @@ function RepoHelperTest_GetRepoIssueTimeTrackingRecords_Pipe Assert-AreEqual -Expected $expectedJson -Presented ($issue | ConvertTo-Json) } -function RepoHelperTest_GetRepoIssueTimeTrackingRecords_SUCCESS{ +function Test_GetRepoIssueTimeTrackingRecords_SUCCESS{ Reset-InvokeCommandMock $owner = "rulasgorg" ; $repo = "repo1" ; $issue = 2 @@ -304,7 +304,7 @@ function RepoHelperTest_GetRepoIssueTimeTrackingRecords_SUCCESS{ Assert-Contains -Expected (Get-Date -Date "February 10, 2024 7:32:50 AM") -Presented $result.CreatedAt } -function RepoHelperTest_GetRepoIssueTimeTrackingRecord_SUCCESS_SeveralTimesInSingleComment +function Test_GetRepoIssueTimeTrackingRecord_SUCCESS_SeveralTimesInSingleComment { Reset-InvokeCommandMock @@ -325,7 +325,7 @@ function RepoHelperTest_GetRepoIssueTimeTrackingRecord_SUCCESS_SeveralTimesInSin Assert-AreEqual -Expected $expectedText -Presented $resultText } -function RepoHelperTest_TimeTracking_ConvertToMinutes{ +function Test_TimeTracking_ConvertToMinutes{ # Wrong input Assert-WrongConvertToMinutes -Tag "1" diff --git a/RepoHelperTest/public/addRepoIssueComment.test.ps1 b/Test/public/addRepoIssueComment.test.ps1 similarity index 91% rename from RepoHelperTest/public/addRepoIssueComment.test.ps1 rename to Test/public/addRepoIssueComment.test.ps1 index afc110d..0243e2d 100644 --- a/RepoHelperTest/public/addRepoIssueComment.test.ps1 +++ b/Test/public/addRepoIssueComment.test.ps1 @@ -1,4 +1,4 @@ -function RepoHelperTest_AddRepoIssueComment_Success{ +function Test_AddRepoIssueComment_Success{ Reset-InvokeCommandMock @@ -14,7 +14,7 @@ function RepoHelperTest_AddRepoIssueComment_Success{ Assert-AreEqual -Expected $mockUrl -Presented $result } -function RepoHelperTest_AddRepoIssueComment_Success_minimalCommand{ +function Test_AddRepoIssueComment_Success_minimalCommand{ Reset-InvokeCommandMock @@ -31,7 +31,7 @@ function RepoHelperTest_AddRepoIssueComment_Success_minimalCommand{ Assert-AreEqual -Expected $mockUrl -Presented $result } -function RepoHelperTest_AddRepoIssueComment_WrongIssueNumber{ +function Test_AddRepoIssueComment_WrongIssueNumber{ Reset-InvokeCommandMock @@ -49,7 +49,7 @@ function RepoHelperTest_AddRepoIssueComment_WrongIssueNumber{ Assert-Contains -Expected "Error adding comment to issue $number for $owner/$repo" -Presented $errorvar.exception.Message } -function RepoHelperTest_GetRepoIssues_Success{ +function Test_GetRepoIssues_Success{ Reset-InvokeCommandMock diff --git a/RepoHelperTest/public/getRepoAccess.test.ps1 b/Test/public/getRepoAccess.test.ps1 similarity index 92% rename from RepoHelperTest/public/getRepoAccess.test.ps1 rename to Test/public/getRepoAccess.test.ps1 index f6cffaf..29affc1 100644 --- a/RepoHelperTest/public/getRepoAccess.test.ps1 +++ b/Test/public/getRepoAccess.test.ps1 @@ -1,5 +1,5 @@ -function RepoHelperTest_GetRepoAccessAll_SUCCESS{ +function Test_GetRepoAccessAll_SUCCESS{ $owner = 'solidifycustomers' ; $repo = 'bit21' @@ -17,7 +17,7 @@ function RepoHelperTest_GetRepoAccessAll_SUCCESS{ Assert-AreEqual -Expected $result.raulgeukk -Presented 'write' } -function RepoHelperTest_GetRepoAccess_Success_FromAccess{ +function Test_GetRepoAccess_Success_FromAccess{ $owner = 'solidifycustomers' ; $repo = 'bit21' ; $user = 'raulgeukk' @@ -33,7 +33,7 @@ function RepoHelperTest_GetRepoAccess_Success_FromAccess{ Assert-AreEqual -Expected 'write' -Presented $result.$user } -function RepoHelperTest_GetRepoAccess_Success_FromInvites{ +function Test_GetRepoAccess_Success_FromInvites{ $owner = 'solidifycustomers' ; $repo = 'bit21' ; $user = 'raulgeu' @@ -51,7 +51,7 @@ function RepoHelperTest_GetRepoAccess_Success_FromInvites{ -function RepoHelperTest_TestRepoAccess_Success_True{ +function Test_TestRepoAccess_Success_True{ $owner = 'solidifycustomers' ; $repo = 'bit21' ; $user = 'raulgeu' @@ -62,7 +62,7 @@ function RepoHelperTest_TestRepoAccess_Success_True{ Assert-IsTrue -Condition $result } -function RepoHelperTest_TestRepoAccess_Success_False{ +function Test_TestRepoAccess_Success_False{ $testnotfound = $PSScriptRoot | Join-Path -ChildPath 'testData' -AdditionalChildPath 'testRepoAccessNotFound.json' diff --git a/RepoHelperTest/public/getRepoAccessInvitation.test.ps1 b/Test/public/getRepoAccessInvitation.test.ps1 similarity index 91% rename from RepoHelperTest/public/getRepoAccessInvitation.test.ps1 rename to Test/public/getRepoAccessInvitation.test.ps1 index 109e10b..7adf313 100644 --- a/RepoHelperTest/public/getRepoAccessInvitation.test.ps1 +++ b/Test/public/getRepoAccessInvitation.test.ps1 @@ -1,4 +1,4 @@ -function RepoHelperTest_GetRepoInvitations_SUCCESS{ +function Test_GetRepoInvitations_SUCCESS{ $owner = 'solidifycustomers' ; $repo = 'bit21' ; $user = 'raulgeu' ; $role = 'write' @@ -10,7 +10,7 @@ function RepoHelperTest_GetRepoInvitations_SUCCESS{ Assert-AreEqual -Expected $result.$user -Presented $role } -function RepoHelperTest_GetRepoInvitations_SUCCESS_Ids{ +function Test_GetRepoInvitations_SUCCESS_Ids{ $owner = 'solidifycustomers' ; $repo = 'bit21' ; $id = 243067060 ; $user = 'raulgeu' @@ -22,7 +22,7 @@ function RepoHelperTest_GetRepoInvitations_SUCCESS_Ids{ Assert-AreEqual -Expected $result.$user -Presented $id } -function RepoHelperTest_GetRepoInvitations_Empty{ +function Test_GetRepoInvitations_Empty{ $owner = 'solidifycustomers' ; $repo = 'bit21' Set-InvokeCommandMock -Alias "gh api repos/$owner/$repo/invitations --paginate" -Command 'echo "[]"' @@ -37,7 +37,7 @@ function RepoHelperTest_GetRepoInvitations_Empty{ Assert-Count -Expected 0 -Presented $result } -function RepoHelperTest_RemoveRepoInvitations_SUCCESS{ +function Test_RemoveRepoInvitations_SUCCESS{ $owner = 'solidifycustomers' ; $repo = 'bit21' ; $id = 243067060 ; $user = 'raulgeu' @@ -53,7 +53,7 @@ function RepoHelperTest_RemoveRepoInvitations_SUCCESS{ Assert-Count -Expected 0 -Presented $warningVar.messages } -function RepoHelperTest_RemoveRepoInvitations_NoUser{ +function Test_RemoveRepoInvitations_NoUser{ $owner = 'solidifycustomers' ; $repo = 'bit21' ; $id = 243067060 ; $user = 'raulgeu' diff --git a/RepoHelperTest/public/getRepoAccessTeam.Test.ps1 b/Test/public/getRepoAccessTeam.Test.ps1 similarity index 98% rename from RepoHelperTest/public/getRepoAccessTeam.Test.ps1 rename to Test/public/getRepoAccessTeam.Test.ps1 index c01b0de..09cf0b7 100644 --- a/RepoHelperTest/public/getRepoAccessTeam.Test.ps1 +++ b/Test/public/getRepoAccessTeam.Test.ps1 @@ -1,5 +1,5 @@ function -RepoHelperTest_GetRepoAccessTeam_Success{ +Test_GetRepoAccessTeam_Success{ Reset-InvokeCommandMock @@ -36,7 +36,7 @@ RepoHelperTest_GetRepoAccessTeam_Success{ Assert-IsTrue -Condition ($result[5] -like '*| write |*' ) } -function RepoHelperTest_GetRepoAccessTeam_Success_NoHead{ +function Test_GetRepoAccessTeam_Success_NoHead{ Reset-InvokeCommandMock diff --git a/RepoHelperTest/public/getRepoProperties.test.ps1 b/Test/public/getRepoProperties.test.ps1 similarity index 89% rename from RepoHelperTest/public/getRepoProperties.test.ps1 rename to Test/public/getRepoProperties.test.ps1 index 78580bb..ba7d278 100644 --- a/RepoHelperTest/public/getRepoProperties.test.ps1 +++ b/Test/public/getRepoProperties.test.ps1 @@ -1,4 +1,4 @@ -function RepoHelperTest_GetRepoProperties_Success{ +function Test_GetRepoProperties_Success{ $owner = 'solidifycustomers' ; $repo = 'bit21' ; $user = 'rulasg' @@ -11,7 +11,7 @@ function RepoHelperTest_GetRepoProperties_Success{ Assert-AreEqual -Expected $result.expiresAt.ToString('yyMMdd') -Presented '240831' } -function RepoHelperTest_GetRepoProperties_NoProperties{ +function Test_GetRepoProperties_NoProperties{ $owner = 'solidifycustomers' ; $repo = 'bit22' $mockFile = $PSScriptRoot | Join-Path -ChildPath 'testData' -AdditionalChildPath 'getRepoInfoNoProperties.json' @@ -22,7 +22,7 @@ function RepoHelperTest_GetRepoProperties_NoProperties{ Assert-Count -Expected 0 -Presented $result } -function RepoHelperTest_GetRepoProperties_NoRepo{ +function Test_GetRepoProperties_NoRepo{ $owner = 'solidifycustomers' ; $repo = 'wrongRepo' $mockFile = $PSScriptRoot | Join-Path -ChildPath 'testData' -AdditionalChildPath 'getRepoPropertiesNotFound.json' diff --git a/RepoHelperTest/public/getRepoPropertiesSchema.test.ps1 b/Test/public/getRepoPropertiesSchema.test.ps1 similarity index 93% rename from RepoHelperTest/public/getRepoPropertiesSchema.test.ps1 rename to Test/public/getRepoPropertiesSchema.test.ps1 index 17fab5d..e61add9 100644 --- a/RepoHelperTest/public/getRepoPropertiesSchema.test.ps1 +++ b/Test/public/getRepoPropertiesSchema.test.ps1 @@ -1,4 +1,4 @@ -function RepoHelperTest_GetRepoPropertiesSchema_Success{ +function Test_GetRepoPropertiesSchema_Success{ $owner = 'solidifycustomers' @@ -18,7 +18,7 @@ function RepoHelperTest_GetRepoPropertiesSchema_Success{ Assert-AreEqual -Presented $resultOwner.values_editable_by -Expected "org_and_repo_actors" } -function RepoHelperTest_GetRepoProperties_NotFound{ +function Test_GetRepoProperties_NotFound{ $owner = 'solidifycustomers22' @@ -31,7 +31,7 @@ function RepoHelperTest_GetRepoProperties_NotFound{ } -function RepoHelperTest_GetRepoProperties_OneResult{ +function Test_GetRepoProperties_OneResult{ $owner = 'solidify-internal' diff --git a/RepoHelperTest/public/grantRepoAccess.test.ps1 b/Test/public/grantRepoAccess.test.ps1 similarity index 94% rename from RepoHelperTest/public/grantRepoAccess.test.ps1 rename to Test/public/grantRepoAccess.test.ps1 index 5960207..eddddb9 100644 --- a/RepoHelperTest/public/grantRepoAccess.test.ps1 +++ b/Test/public/grantRepoAccess.test.ps1 @@ -1,4 +1,4 @@ -function RepoHelperTest_GrantRepoAccess_SUCCESS_NotCache{ +function Test_GrantRepoAccess_SUCCESS_NotCache{ Reset-InvokeCommandMock @@ -17,7 +17,7 @@ function RepoHelperTest_GrantRepoAccess_SUCCESS_NotCache{ Assert-AreEqual -Expected $result.$user -Presented $role } -function RepoHelperTest_GrantRepoAccess_SUCCESS_Cached{ +function Test_GrantRepoAccess_SUCCESS_Cached{ Reset-InvokeCommandMock @@ -35,7 +35,7 @@ function RepoHelperTest_GrantRepoAccess_SUCCESS_Cached{ Assert-AreEqual -Expected $result.$user -Presented $role } -function RepoHelperTest_GrantRepoAccess_fail_wrong_user_repo_owner{ +function Test_GrantRepoAccess_fail_wrong_user_repo_owner{ $owner = 'solidifycustomers' ; $repo = 'bit21' ; $user = 'wrongUser' ; $role = 'triage' Reset-InvokeCommandMock diff --git a/RepoHelperTest/public/label-add.test.ps1 b/Test/public/label-add.test.ps1 similarity index 97% rename from RepoHelperTest/public/label-add.test.ps1 rename to Test/public/label-add.test.ps1 index 94cf58c..2742749 100644 --- a/RepoHelperTest/public/label-add.test.ps1 +++ b/Test/public/label-add.test.ps1 @@ -1,6 +1,6 @@ # create a test to call Add-RepoLabel and check result -function RepoHelperTest_RepoLabel_Add{ +function Test_RepoLabel_Add{ # simple call $result = Add-RepoLabel -Name 'testLabel' -whatif @InfoParameters @@ -34,7 +34,7 @@ function RepoHelperTest_RepoLabel_Add{ } # create a test to call Import-RepoLabels and check result -function RepoHelperTest_RepoLabel_Import{ +function Test_RepoLabel_Import{ # create a test file $testFile = New-TestingFile -Name 'testLabels.json' -PassThru -Content @' diff --git a/RepoHelperTest/public/label-delete.test.ps1 b/Test/public/label-delete.test.ps1 similarity index 92% rename from RepoHelperTest/public/label-delete.test.ps1 rename to Test/public/label-delete.test.ps1 index 8024138..90cb624 100644 --- a/RepoHelperTest/public/label-delete.test.ps1 +++ b/Test/public/label-delete.test.ps1 @@ -1,6 +1,6 @@ # create a test function that calls Remove-RepoLabel and checks the result -function RepoHelperTest_RepoLabel_Remove{ +function Test_RepoLabel_Remove{ # simple call $result = Remove-RepoLabel -Name 'testLabel' -whatif @InfoParameters diff --git a/RepoHelperTest/public/label-get.test.ps1 b/Test/public/label-get.test.ps1 similarity index 91% rename from RepoHelperTest/public/label-get.test.ps1 rename to Test/public/label-get.test.ps1 index e9c2806..007949a 100644 --- a/RepoHelperTest/public/label-get.test.ps1 +++ b/Test/public/label-get.test.ps1 @@ -1,7 +1,7 @@ # create a test function that calls Get-RepoLabels and checks the result -function RepoHelperTest_RepoLabel_List{ +function Test_RepoLabel_List{ # simple call $result = Get-RepoLabels -whatif @InfoParameters @@ -16,7 +16,7 @@ function RepoHelperTest_RepoLabel_List{ # craete a test that calls Export-RepoLabels and checks the result -function RepoHelperTest_RepoLabel_Export{ +function Test_RepoLabel_Export{ # simple call $result = Export-RepoLabels -Repo "rulasg/testpublicrepo" -Path test.json -WhatIf @InfoParameters diff --git a/RepoHelperTest/public/repo-create.test.ps1 b/Test/public/repo-create.test.ps1 similarity index 93% rename from RepoHelperTest/public/repo-create.test.ps1 rename to Test/public/repo-create.test.ps1 index 2df70a5..592b056 100644 --- a/RepoHelperTest/public/repo-create.test.ps1 +++ b/Test/public/repo-create.test.ps1 @@ -1,4 +1,4 @@ -function RepoHelperTest_Create_Repo_Path{ +function Test_Create_Repo_Path{ $repoName = 'testModule_{0}' -f $((New-guid).Guid.Substring(0,8)) $repoDescription = 'A demo for testing' @@ -17,7 +17,7 @@ function RepoHelperTest_Create_Repo_Path{ } -function RepoHelperTest_Create_Repo_Local{ +function Test_Create_Repo_Local{ $repoName = 'testModule_{0}' -f $((New-guid).Guid.Substring(0,8)) @@ -40,7 +40,7 @@ function RepoHelperTest_Create_Repo_Local{ Assert-Contains -Expected $expectedCommand -presented $infoVar -Comment "Command not as expected" } -function RepoHelperTest_Create_Repo_Local_Folder{ +function Test_Create_Repo_Local_Folder{ $repoName = 'testModule_{0}' -f $((New-guid).Guid.Substring(0,8)) diff --git a/RepoHelperTest/public/repo-search.test.ps1 b/Test/public/repo-search.test.ps1 similarity index 88% rename from RepoHelperTest/public/repo-search.test.ps1 rename to Test/public/repo-search.test.ps1 index b982e6c..87cdf05 100644 --- a/RepoHelperTest/public/repo-search.test.ps1 +++ b/Test/public/repo-search.test.ps1 @@ -1,7 +1,7 @@ $attributes = 'name,url' -function RepoHelperTest_Search_Repo_Name{ +function Test_Search_Repo_Name{ $expectedcommand = "gh search repos testName in:name --json {attributes}" -replace "{attributes}", "$($attributes)" $result = Find-RepoByName -Name "testName" @InfoParameters -whatif @@ -10,7 +10,7 @@ function RepoHelperTest_Search_Repo_Name{ Assert-Contains -Expected $expectedcommand -presented $infoVar -Comment "Command not as expected" } -function RepoHelperTest_Search_Repo_NameWithOwner{ +function Test_Search_Repo_NameWithOwner{ $expectedcommand = "gh search repos testName in:name user:testOwner --json {attributes}" -replace "{attributes}", "$($attributes)" diff --git a/RepoHelperTest/public/repo-test.ps1 b/Test/public/repo-test.ps1 similarity index 77% rename from RepoHelperTest/public/repo-test.ps1 rename to Test/public/repo-test.ps1 index e76c311..6c4cae7 100644 --- a/RepoHelperTest/public/repo-test.ps1 +++ b/Test/public/repo-test.ps1 @@ -1,4 +1,4 @@ -function RepoHelperTest_Repo_Test_Manual{ +function Test_Repo_Test_Manual{ Assert-SkipTest diff --git a/RepoHelperTest/public/setRepoPropertiesSuccess.test.ps1 b/Test/public/setRepoPropertiesSuccess.test.ps1 similarity index 94% rename from RepoHelperTest/public/setRepoPropertiesSuccess.test.ps1 rename to Test/public/setRepoPropertiesSuccess.test.ps1 index f6c4b00..13d5838 100644 --- a/RepoHelperTest/public/setRepoPropertiesSuccess.test.ps1 +++ b/Test/public/setRepoPropertiesSuccess.test.ps1 @@ -1,4 +1,4 @@ -function RepoHelperTest_SetRepoProperties_Success{ +function Test_SetRepoProperties_Success{ $owner = 'solidifydemo' ; $repo = 'bit21' ; $property = 'kk' ; $value = 'someValuekk' @@ -18,7 +18,7 @@ curl -L -s -H "Authorization: Bearer $env:GH_TOKEN" -X PATCH https://api.github. Assert-IsNull -Object $result -Comment "Set-RepoProperty should return null on success" } -function RepoHelperTest_SetRepoProperties_NotFound{ +function Test_SetRepoProperties_NotFound{ $owner = 'solidifydemo' ; $repo = 'bit21' ; $property = 'kk' ; $value = 'someValuekk' diff --git a/RepoHelperTest/public/syncRepoAccess.test.ps1 b/Test/public/syncRepoAccess.test.ps1 similarity index 95% rename from RepoHelperTest/public/syncRepoAccess.test.ps1 rename to Test/public/syncRepoAccess.test.ps1 index de6acee..44db8a9 100644 --- a/RepoHelperTest/public/syncRepoAccess.test.ps1 +++ b/Test/public/syncRepoAccess.test.ps1 @@ -1,4 +1,4 @@ -function RepoHelperTest_SyncRepoAccessAll_Success_Write{ +function Test_SyncRepoAccessAll_Success_Write{ $owner = 'solidifycustomers' ; $repo = 'bit21' Reset-InvokeCommandMock @@ -44,7 +44,7 @@ rulasg } -function RepoHelperTest_SyncRepoAccessAll_Success_Admin{ +function Test_SyncRepoAccessAll_Success_Admin{ $owner = 'solidifycustomers' ; $repo = 'bit21' Reset-InvokeCommandMock @@ -91,7 +91,7 @@ rulasg } -function RepoHelperTest_SyncRepoAccessAll_Success_Admin_WhatIf{ +function Test_SyncRepoAccessAll_Success_Admin_WhatIf{ $owner = 'solidifycustomers' ; $repo = 'bit21' Reset-InvokeCommandMock @@ -131,7 +131,7 @@ rulasg } -function RepoHelperTest_SyncRepoAccess_EnvironmentParameters{ +function Test_SyncRepoAccess_EnvironmentParameters{ $owner = 'solidifycustomers' ; $repo = 'bit21' Reset-InvokeCommandMock @@ -161,7 +161,7 @@ function RepoHelperTest_SyncRepoAccess_EnvironmentParameters{ Assert-AreEqual -Expected '-' -Presented $result.MagnusTim } -function RepoHelperTest_SyncRepoAccess_NoParameters { +function Test_SyncRepoAccess_NoParameters { Reset-InvokeCommandMock @@ -179,7 +179,7 @@ function RepoHelperTest_SyncRepoAccess_NoParameters { Assert-Contains -Expected "[Sync-RepoAccess] Owner and Repo parameters are required" -Presented $errorvar.Exception.Message } -function RepoHelperTest_SyncRepoAccess_NoUsersFile { +function Test_SyncRepoAccess_NoUsersFile { $owner = 'solidifycustomers' ; $repo = 'bit21' ; $file = "contributors" Reset-InvokeCommandMock @@ -192,7 +192,7 @@ function RepoHelperTest_SyncRepoAccess_NoUsersFile { Assert-Contains -Expected "Error reading user file $file" -Presented $errorvar.Exception.Message } -function RepoHelperTest_SyncRepoAccess_Error_On_Invitations { +function Test_SyncRepoAccess_Error_On_Invitations { $owner = 'solidifycustomers' ; $repo = 'bit21' Reset-InvokeCommandMock diff --git a/RepoHelperTest/public/testData/getAccessAllSuccess.json b/Test/public/testData/getAccessAllSuccess.json similarity index 100% rename from RepoHelperTest/public/testData/getAccessAllSuccess.json rename to Test/public/testData/getAccessAllSuccess.json diff --git a/RepoHelperTest/public/testData/getAccessInvitationsError.json b/Test/public/testData/getAccessInvitationsError.json similarity index 100% rename from RepoHelperTest/public/testData/getAccessInvitationsError.json rename to Test/public/testData/getAccessInvitationsError.json diff --git a/RepoHelperTest/public/testData/getAccessInvitationsSuccess.json b/Test/public/testData/getAccessInvitationsSuccess.json similarity index 100% rename from RepoHelperTest/public/testData/getAccessInvitationsSuccess.json rename to Test/public/testData/getAccessInvitationsSuccess.json diff --git a/RepoHelperTest/public/testData/getAccessNone.json b/Test/public/testData/getAccessNone.json similarity index 100% rename from RepoHelperTest/public/testData/getAccessNone.json rename to Test/public/testData/getAccessNone.json diff --git a/RepoHelperTest/public/testData/getAccessSuccess.json b/Test/public/testData/getAccessSuccess.json similarity index 100% rename from RepoHelperTest/public/testData/getAccessSuccess.json rename to Test/public/testData/getAccessSuccess.json diff --git a/RepoHelperTest/public/testData/getIssueComments.json b/Test/public/testData/getIssueComments.json similarity index 100% rename from RepoHelperTest/public/testData/getIssueComments.json rename to Test/public/testData/getIssueComments.json diff --git a/RepoHelperTest/public/testData/getIssueComments_2.json b/Test/public/testData/getIssueComments_2.json similarity index 100% rename from RepoHelperTest/public/testData/getIssueComments_2.json rename to Test/public/testData/getIssueComments_2.json diff --git a/RepoHelperTest/public/testData/getIssueComments_MultiTimesInComment.json b/Test/public/testData/getIssueComments_MultiTimesInComment.json similarity index 100% rename from RepoHelperTest/public/testData/getIssueComments_MultiTimesInComment.json rename to Test/public/testData/getIssueComments_MultiTimesInComment.json diff --git a/RepoHelperTest/public/testData/getIssueComments_WrongTTFormat.json b/Test/public/testData/getIssueComments_WrongTTFormat.json similarity index 100% rename from RepoHelperTest/public/testData/getIssueComments_WrongTTFormat.json rename to Test/public/testData/getIssueComments_WrongTTFormat.json diff --git a/RepoHelperTest/public/testData/getIssueList.json b/Test/public/testData/getIssueList.json similarity index 100% rename from RepoHelperTest/public/testData/getIssueList.json rename to Test/public/testData/getIssueList.json diff --git a/RepoHelperTest/public/testData/getRepoInfoNoProperties.json b/Test/public/testData/getRepoInfoNoProperties.json similarity index 100% rename from RepoHelperTest/public/testData/getRepoInfoNoProperties.json rename to Test/public/testData/getRepoInfoNoProperties.json diff --git a/RepoHelperTest/public/testData/getRepoInfoSuccess.json b/Test/public/testData/getRepoInfoSuccess.json similarity index 100% rename from RepoHelperTest/public/testData/getRepoInfoSuccess.json rename to Test/public/testData/getRepoInfoSuccess.json diff --git a/RepoHelperTest/public/testData/getRepoPropertiesNotFound.json b/Test/public/testData/getRepoPropertiesNotFound.json similarity index 100% rename from RepoHelperTest/public/testData/getRepoPropertiesNotFound.json rename to Test/public/testData/getRepoPropertiesNotFound.json diff --git a/RepoHelperTest/public/testData/getRepoPropertiesSchema.json b/Test/public/testData/getRepoPropertiesSchema.json similarity index 100% rename from RepoHelperTest/public/testData/getRepoPropertiesSchema.json rename to Test/public/testData/getRepoPropertiesSchema.json diff --git a/RepoHelperTest/public/testData/getRepoPropertiesSchemaNotFound.json b/Test/public/testData/getRepoPropertiesSchemaNotFound.json similarity index 100% rename from RepoHelperTest/public/testData/getRepoPropertiesSchemaNotFound.json rename to Test/public/testData/getRepoPropertiesSchemaNotFound.json diff --git a/RepoHelperTest/public/testData/getRepoPropertiesSchemaOneResult.json b/Test/public/testData/getRepoPropertiesSchemaOneResult.json similarity index 100% rename from RepoHelperTest/public/testData/getRepoPropertiesSchemaOneResult.json rename to Test/public/testData/getRepoPropertiesSchemaOneResult.json diff --git a/RepoHelperTest/public/testData/getUserSuccess_MagnusTim.json b/Test/public/testData/getUserSuccess_MagnusTim.json similarity index 100% rename from RepoHelperTest/public/testData/getUserSuccess_MagnusTim.json rename to Test/public/testData/getUserSuccess_MagnusTim.json diff --git a/RepoHelperTest/public/testData/getUserSuccess_raulgeu.json b/Test/public/testData/getUserSuccess_raulgeu.json similarity index 100% rename from RepoHelperTest/public/testData/getUserSuccess_raulgeu.json rename to Test/public/testData/getUserSuccess_raulgeu.json diff --git a/RepoHelperTest/public/testData/getUserSuccess_raulgeukk.json b/Test/public/testData/getUserSuccess_raulgeukk.json similarity index 100% rename from RepoHelperTest/public/testData/getUserSuccess_raulgeukk.json rename to Test/public/testData/getUserSuccess_raulgeukk.json diff --git a/RepoHelperTest/public/testData/getUserSuccess_rulasg.json b/Test/public/testData/getUserSuccess_rulasg.json similarity index 100% rename from RepoHelperTest/public/testData/getUserSuccess_rulasg.json rename to Test/public/testData/getUserSuccess_rulasg.json diff --git a/RepoHelperTest/public/testData/grantAccessError.json b/Test/public/testData/grantAccessError.json similarity index 100% rename from RepoHelperTest/public/testData/grantAccessError.json rename to Test/public/testData/grantAccessError.json diff --git a/RepoHelperTest/public/testData/grantAccessSuccess.json b/Test/public/testData/grantAccessSuccess.json similarity index 100% rename from RepoHelperTest/public/testData/grantAccessSuccess.json rename to Test/public/testData/grantAccessSuccess.json diff --git a/RepoHelperTest/public/testData/grantAccessSuccessRaulgeuAdmin.json b/Test/public/testData/grantAccessSuccessRaulgeuAdmin.json similarity index 100% rename from RepoHelperTest/public/testData/grantAccessSuccessRaulgeuAdmin.json rename to Test/public/testData/grantAccessSuccessRaulgeuAdmin.json diff --git a/RepoHelperTest/public/testData/grantAccessSuccessRulasg.json b/Test/public/testData/grantAccessSuccessRulasg.json similarity index 100% rename from RepoHelperTest/public/testData/grantAccessSuccessRulasg.json rename to Test/public/testData/grantAccessSuccessRulasg.json diff --git a/RepoHelperTest/public/testData/grantAccessSuccessRulasgAdmin.json b/Test/public/testData/grantAccessSuccessRulasgAdmin.json similarity index 100% rename from RepoHelperTest/public/testData/grantAccessSuccessRulasgAdmin.json rename to Test/public/testData/grantAccessSuccessRulasgAdmin.json diff --git a/RepoHelperTest/public/testData/setRepoPropertiesNotFound.json b/Test/public/testData/setRepoPropertiesNotFound.json similarity index 100% rename from RepoHelperTest/public/testData/setRepoPropertiesNotFound.json rename to Test/public/testData/setRepoPropertiesNotFound.json diff --git a/RepoHelperTest/public/testData/testRepoAccessNotFound.json b/Test/public/testData/testRepoAccessNotFound.json similarity index 100% rename from RepoHelperTest/public/testData/testRepoAccessNotFound.json rename to Test/public/testData/testRepoAccessNotFound.json From d3b86a105a42b6961b360ef490fc4eeec6b6ab65 Mon Sep 17 00:00:00 2001 From: rulasg Date: Wed, 12 Feb 2025 08:56:43 +0100 Subject: [PATCH 2/2] Refactor logging in Import-RequiredModule and update output type in Get-RequiredModule --- deploy.ps1 | 2 +- test.ps1 | 6 +++--- tools/deploy.Helper.ps1 | 1 - 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/deploy.ps1 b/deploy.ps1 index 8f43d7a..69e7bec 100644 --- a/deploy.ps1 +++ b/deploy.ps1 @@ -83,4 +83,4 @@ if ( [string]::IsNullOrWhiteSpace($NuGetApiKey) ) { } # Deploy module to PSGallery -Invoke-DeployModuleToPSGallery -NuGetApiKey $NuGetApiKey -Force -ModuleManifestPath $MODULE_PSD1 +Invoke-DeployModuleToPSGallery -NuGetApiKey $NuGetApiKey -Force -ModuleManifestPath $MODULE_PSD1 \ No newline at end of file diff --git a/test.ps1 b/test.ps1 index ce8592d..d34447b 100644 --- a/test.ps1 +++ b/test.ps1 @@ -81,7 +81,7 @@ function Import-RequiredModule{ $ModuleVersion = [string]::IsNullOrWhiteSpace($RequiredModule.RequiredVersion) ? $RequiredModule.ModuleVersion : $RequiredModule.RequiredVersion } - "Importing module Name[{0}] Version[{1}] AllowPrerelease[{2}]" -f $ModuleName, $ModuleVersion, $AllowPrerelease | Write-Host -ForegroundColor DarkGray + "Importing module Name[{0}] Version[{1}] AllowPrerelease[{2}]" -f $ModuleName, $ModuleVersion, $AllowPrerelease | Write-Verbose # Following semVer we can manually specidy a taged version to specify that is prerelease # Extract the semVer from it and set AllowPrerelease to true @@ -113,7 +113,7 @@ function Import-RequiredModule{ #> function Get-RequiredModule{ [CmdletBinding()] - [OutputType([hashtable[]])] + [OutputType([Object[]])] param() # Required Modules @@ -135,7 +135,7 @@ function Get-RequiredModule{ Import-RequiredModule "TestingHelper" -AllowPrerelease # Install and Load Module dependencies -Get-RequiredModule | Import-RequiredModule -AllowPrerelease +Get-RequiredModule | Import-RequiredModule -AllowPrerelease if($TestName){ Invoke-TestingHelper -TestName $TestName -ShowTestErrors:$ShowTestErrors diff --git a/tools/deploy.Helper.ps1 b/tools/deploy.Helper.ps1 index b0d66fa..39767e9 100644 --- a/tools/deploy.Helper.ps1 +++ b/tools/deploy.Helper.ps1 @@ -177,4 +177,3 @@ function Get-DeployModulePreRelease { $preRelease = $preRelease ?? " " $preRelease } -