Skip to content

Commit ef60f0f

Browse files
committed
Add tests for the IssuePrintFormatter
This adds tests to cover the methods inside the IssuePrintFormatter. Note: there is some over-testing in a few of these cases because of how both Issue and Label are defined. We would need to refactor them to use interfaces for mocking out this functionality if these tests are to be pure unit tests. As of now, that seems like a bit too much work for the scope of this commit.
1 parent cca04cf commit ef60f0f

4 files changed

Lines changed: 631 additions & 14 deletions

File tree

pkg/cmd/issue/view/issuePrintFormatter.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@ type IssuePrintFormatter struct {
2121
baseRepo ghrepo.Interface
2222
}
2323

24+
func NewIssuePrintFormatter(issue *api.Issue, IO *iostreams.IOStreams, timeNow time.Time, baseRepo ghrepo.Interface) *IssuePrintFormatter {
25+
return &IssuePrintFormatter{
26+
issue: issue,
27+
colorScheme: IO.ColorScheme(),
28+
IO: IO,
29+
time: timeNow,
30+
baseRepo: baseRepo,
31+
}
32+
}
33+
2434
func (i *IssuePrintFormatter) header() {
2535
fmt.Fprintf(i.IO.Out, "%s %s#%d\n", i.colorScheme.Bold(i.issue.Title), ghrepo.FullName(i.baseRepo), i.issue.Number)
2636
fmt.Fprintf(i.IO.Out,

0 commit comments

Comments
 (0)