-
Notifications
You must be signed in to change notification settings - Fork 8k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
The current implementation of issue view tests doesn't mock the current time and makes test fail after 2021-01-23.
Steps to reproduce the behavior
- Clone
cli/cli - Type
go test ./pkg/cmd/issue/view - See
FAIL: TestIssueView_tty_Preview (0.00s)
--- FAIL: TestIssueView_tty_Preview/Open_issue_with_empty_body (0.00s)
view_test.go:267: output did not match regexp /Open.*marseilles opened about 9 years ago.*9 comments/
> output
ix of coins
Open • marseilles opened about 10 years ago • 9 comments
Labels: tarot
These tests started to fail 2 days ago because the dates in the test fixtures point to 2011-01-26
| "createdAt": "2011-01-26T19:01:12Z", |
cli/pkg/cmd/issue/view/view.go
Lines 142 to 145 in 6e2c1b3
| func printHumanIssuePreview(opts *ViewOptions, issue *api.Issue) error { | |
| out := opts.IO.Out | |
| now := time.Now() | |
| ago := now.Sub(issue.CreatedAt) |
output:
Open • marseilles opened about 10 years ago • 9 comments
instead of:
Open • marseilles opened about 9 years ago • 9 comments.
See: https://github.com/cli/cli/pull/2839/checks?check_run_id=1758707814#step:5:55
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working