Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion RepoHelperTest/RepoHelperTest.psd1 → Test/Test.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion RepoHelperTest/RepoHelperTest.psm1 → Test/Test.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

function RepoHelperTest_AddRepoIssueTimeTracking_SUCCESS
function Test_AddRepoIssueTimeTracking_SUCCESS
{
Reset-InvokeCommandMock

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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

Expand All @@ -102,7 +102,7 @@ function RepoHelperTest_GetRepoIssueTimeTracking_SUCCESS_SeveralTimesInSingleCom

}

function RepoHelperTest_GetRepoIssueTimeTracking_WrongFormat
function Test_GetRepoIssueTimeTracking_WrongFormat
{
Reset-InvokeCommandMock

Expand All @@ -123,7 +123,7 @@ function RepoHelperTest_GetRepoIssueTimeTracking_WrongFormat
Assert-AreEqual -Expected $expectedJson -Presented $json
}

function RepoHelperTest_GetRepoIssueTimeTracking_Notfound
function Test_GetRepoIssueTimeTracking_Notfound
{
Reset-InvokeCommandMock

Expand All @@ -139,7 +139,7 @@ function RepoHelperTest_GetRepoIssueTimeTracking_Notfound

}

function RepoHelperTest_GetRepoIssueTimeTracking_Pipe
function Test_GetRepoIssueTimeTracking_Pipe
{
Reset-InvokeCommandMock

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function RepoHelperTest_AddRepoIssueComment_Success{
function Test_AddRepoIssueComment_Success{

Reset-InvokeCommandMock

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

function RepoHelperTest_GetRepoAccessAll_SUCCESS{
function Test_GetRepoAccessAll_SUCCESS{

$owner = 'solidifycustomers' ; $repo = 'bit21'

Expand All @@ -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'

Expand All @@ -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'

Expand All @@ -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'

Expand All @@ -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'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function RepoHelperTest_GetRepoInvitations_SUCCESS{
function Test_GetRepoInvitations_SUCCESS{

$owner = 'solidifycustomers' ; $repo = 'bit21' ; $user = 'raulgeu' ; $role = 'write'

Expand All @@ -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'

Expand All @@ -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 "[]"'
Expand All @@ -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'

Expand All @@ -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'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function
RepoHelperTest_GetRepoAccessTeam_Success{
Test_GetRepoAccessTeam_Success{

Reset-InvokeCommandMock

Expand Down Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function RepoHelperTest_GetRepoProperties_Success{
function Test_GetRepoProperties_Success{

$owner = 'solidifycustomers' ; $repo = 'bit21' ; $user = 'rulasg'

Expand All @@ -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'
Expand All @@ -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'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function RepoHelperTest_GetRepoPropertiesSchema_Success{
function Test_GetRepoPropertiesSchema_Success{

$owner = 'solidifycustomers'

Expand All @@ -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'

Expand All @@ -31,7 +31,7 @@ function RepoHelperTest_GetRepoProperties_NotFound{
}


function RepoHelperTest_GetRepoProperties_OneResult{
function Test_GetRepoProperties_OneResult{

$owner = 'solidify-internal'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function RepoHelperTest_GrantRepoAccess_SUCCESS_NotCache{
function Test_GrantRepoAccess_SUCCESS_NotCache{

Reset-InvokeCommandMock

Expand All @@ -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

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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 @'
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
Loading
Loading