Skip to content

Commit

Permalink
More updates based on feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
etgottli committed Dec 7, 2018
1 parent 0f9c8c9 commit 9562901
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 14 deletions.
4 changes: 2 additions & 2 deletions GitHubComments.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ function Get-GitHubComment
Issue number to get comments for. If not supplied, will return back all comments for this repository.
.PARAMETER Sort
How to sort the results, either created or updated.
How to sort the results.
.PARAMETER Direction
How to list the results, either asc or desc. Ignored without the sort parameter.
How to list the results. Ignored without the sort parameter.
.PARAMETER Since
Only comments updated at or after this time are returned.
Expand Down
10 changes: 5 additions & 5 deletions GitHubMilestones.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ function Get-GitHubMilestone
The number of a specific milestone to get. If not supplied, will return back all milestones for this repository.
.PARAMETER Sort
How to sort the results, either DueOn or Completeness.
How to sort the results.
.PARAMETER Direction
How to list the results, either Ascending or Descending. Ignored without the sort parameter.
How to list the results. Ignored without the sort parameter.
.PARAMETER State
Only milestones with this state are returned, either Open, Closed, or All.
Only milestones with this state are returned.
.PARAMETER AccessToken
If provided, this will be used as the AccessToken for authentication with the
Expand Down Expand Up @@ -184,7 +184,7 @@ function New-GitHubMilestone
The title of the milestone.
.PARAMETER State
The state of the milestone, either Open or Closed.
The state of the milestone.
.PARAMETER Description
A description of the milestone.
Expand Down Expand Up @@ -312,7 +312,7 @@ function Set-GitHubMilestone
The title of the milestone.
.PARAMETER State
The state of the milestone, either Open or Closed.
The state of the milestone.
.PARAMETER Description
A description of the milestone.
Expand Down
16 changes: 15 additions & 1 deletion Tests/GitHubMilestones.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ try
# Define Script-scoped, readonly, hidden variables.

@{
defaultIssueTitle = "This is a test issue."
defaultMilestoneTitle1 = "This is a test milestone title #1."
defaultMilestoneTitle2 = "This is a test milestone title #2."
defaultEditedMilestoneTitle = "This is an edited milestone title."
Expand All @@ -91,6 +92,7 @@ try

Describe 'Creating, modifying and deleting milestones' {
$repo = New-GitHubRepository -RepositoryName ([Guid]::NewGuid().Guid) -AutoInit
$issue = New-GitHubIssue -Uri $repo.svn_url -Title $defaultIssueTitle

Context 'For creating a new milestone' {
$newMilestone = New-GitHubMilestone -Uri $repo.svn_url -Title $defaultMilestoneTitle1 -State "Closed" -DueOn $defaultMilestoneDueOn
Expand All @@ -107,18 +109,28 @@ try
It "Should have the expected due_on date" {
Get-Date -Date $existingMilestone.due_on | Should be $defaultMilestoneDueOn
}

It "Should allow the addition of an existing issue" {
Update-GitHubIssue -Uri $repo.svn_url -Issue $issue.number -Milestone $existingMilestone.number
}
}

Context 'For getting milestones from a repo' {
$existingMilestones = @(Get-GitHubMilestone -Uri $repo.svn_url -State "Closed")
$issue = Get-GitHubIssue -Uri $repo.svn_url -Issue $issue.number

It 'Should have the expected number of milestones' {
$existingMilestones.Count | Should be 1
}

It 'Should have the expected body text on the first milestone' {
It 'Should have the expected title text on the first milestone' {
$existingMilestones[0].title | Should be $defaultMilestoneTitle1
}

It 'Should have the expected issue in the first milestone' {
$existingMilestones[0].open_issues | should be 1
$issue.milestone.number | Should be 1
}
}

Context 'For editing a milestone' {
Expand Down Expand Up @@ -148,9 +160,11 @@ try
}

$existingMilestones = @(Get-GitHubMilestone -Uri $repo.svn_url)
$issue = Get-GitHubIssue -Uri $repo.svn_url -Issue $issue.number

It 'Should have no milestones' {
$existingMilestones.Count | Should be 0
$issue.milestone | Should be $null
}
}

Expand Down
8 changes: 2 additions & 6 deletions USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -432,21 +432,17 @@ Get-GitHubMilestone -OwnerName Powershell -RepositoryName PowerShellForGitHub -S
Get-GitHubMilestone -OwnerName Powershell -RepositoryName PowerShellForGitHub -Milestone 1
```

#### Adding a new milestone
#### Assign an existing issue to a new milestone
```powershell
New-GitHubMilestone -OwnerName Powershell -RepositoryName PowerShellForGitHub -Title "Testing this API"
Update-GitHubIssue -OwnerName PowerShell -RepositoryName PowerShellForGitHub -Issue 2 -Milestone 1
```

#### Editing an existing milestone
```powershell
Set-GitHubMilestone -OwnerName Powershell -RepositoryName PowerShellForGitHub -Milestone 1 -Title "Testing this API edited"
```

#### Add a new issue to an existing milestone
```powershell
New-GitHubIssue -OwnerName PowerShell -RepositoryName PowerShellForGitHub -Title "Test Issue" -Milestone 1
```

#### Removing a milestone
```powershell
Remove-GitHubMilestone -OwnerName Powershell -RepositoryName PowerShellForGitHub -Milestone 1
Expand Down

0 comments on commit 9562901

Please sign in to comment.