"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "pkg/cmd/issue/view/view_test.go" between
gh-cli-1.10.3.tar.gz and gh-cli-1.11.0.tar.gz

About: GitHub CLI is GitHub’s official command line tool.

view_test.go  (gh-cli-1.10.3):view_test.go  (gh-cli-1.11.0)
skipping to change at line 115 skipping to change at line 115
expectedOutputs []string expectedOutputs []string
}{ }{
"Open issue without metadata": { "Open issue without metadata": {
fixture: "./fixtures/issueView_preview.json", fixture: "./fixtures/issueView_preview.json",
expectedOutputs: []string{ expectedOutputs: []string{
`title:\tix of coins`, `title:\tix of coins`,
`state:\tOPEN`, `state:\tOPEN`,
`comments:\t9`, `comments:\t9`,
`author:\tmarseilles`, `author:\tmarseilles`,
`assignees:`, `assignees:`,
`number:\t123\n`,
`\*\*bold story\*\*`, `\*\*bold story\*\*`,
}, },
}, },
"Open issue with metadata": { "Open issue with metadata": {
fixture: "./fixtures/issueView_previewWithMetadata.json", fixture: "./fixtures/issueView_previewWithMetadata.json",
expectedOutputs: []string{ expectedOutputs: []string{
`title:\tix of coins`, `title:\tix of coins`,
`assignees:\tmarseilles, monaco`, `assignees:\tmarseilles, monaco`,
`author:\tmarseilles`, `author:\tmarseilles`,
`state:\tOPEN`, `state:\tOPEN`,
`comments:\t9`, `comments:\t9`,
`labels:\tone, two, three, four, five`, `labels:\tone, two, three, four, five`,
`projects:\tProject 1 \(column A\), Project 2 \(c olumn B\), Project 3 \(column C\), Project 4 \(Awaiting triage\)\n`, `projects:\tProject 1 \(column A\), Project 2 \(c olumn B\), Project 3 \(column C\), Project 4 \(Awaiting triage\)\n`,
`milestone:\tuluru\n`, `milestone:\tuluru\n`,
`number:\t123\n`,
`\*\*bold story\*\*`, `\*\*bold story\*\*`,
}, },
}, },
"Open issue with empty body": { "Open issue with empty body": {
fixture: "./fixtures/issueView_previewWithEmptyBody.json" , fixture: "./fixtures/issueView_previewWithEmptyBody.json" ,
expectedOutputs: []string{ expectedOutputs: []string{
`title:\tix of coins`, `title:\tix of coins`,
`state:\tOPEN`, `state:\tOPEN`,
`author:\tmarseilles`, `author:\tmarseilles`,
`labels:\ttarot`, `labels:\ttarot`,
`number:\t123\n`,
}, },
}, },
"Closed issue": { "Closed issue": {
fixture: "./fixtures/issueView_previewClosedState.json", fixture: "./fixtures/issueView_previewClosedState.json",
expectedOutputs: []string{ expectedOutputs: []string{
`title:\tix of coins`, `title:\tix of coins`,
`state:\tCLOSED`, `state:\tCLOSED`,
`\*\*bold story\*\*`, `\*\*bold story\*\*`,
`author:\tmarseilles`, `author:\tmarseilles`,
`labels:\ttarot`, `labels:\ttarot`,
`number:\t123\n`,
`\*\*bold story\*\*`, `\*\*bold story\*\*`,
}, },
}, },
} }
for name, tc := range tests { for name, tc := range tests {
t.Run(name, func(t *testing.T) { t.Run(name, func(t *testing.T) {
http := &httpmock.Registry{} http := &httpmock.Registry{}
defer http.Verify(t) defer http.Verify(t)
http.Register(httpmock.GraphQL(`query IssueByNumber\b`), httpmock.FileResponse(tc.fixture)) http.Register(httpmock.GraphQL(`query IssueByNumber\b`), httpmock.FileResponse(tc.fixture))
skipping to change at line 181 skipping to change at line 185
} }
func TestIssueView_tty_Preview(t *testing.T) { func TestIssueView_tty_Preview(t *testing.T) {
tests := map[string]struct { tests := map[string]struct {
fixture string fixture string
expectedOutputs []string expectedOutputs []string
}{ }{
"Open issue without metadata": { "Open issue without metadata": {
fixture: "./fixtures/issueView_preview.json", fixture: "./fixtures/issueView_preview.json",
expectedOutputs: []string{ expectedOutputs: []string{
`ix of coins`, `ix of coins #123`,
`Open.*marseilles opened about 9 years ago.*9 com ments`, `Open.*marseilles opened about 9 years ago.*9 com ments`,
`bold story`, `bold story`,
`View this issue on GitHub: https://github.com/OW NER/REPO/issues/123`, `View this issue on GitHub: https://github.com/OW NER/REPO/issues/123`,
}, },
}, },
"Open issue with metadata": { "Open issue with metadata": {
fixture: "./fixtures/issueView_previewWithMetadata.json", fixture: "./fixtures/issueView_previewWithMetadata.json",
expectedOutputs: []string{ expectedOutputs: []string{
`ix of coins`, `ix of coins #123`,
`Open.*marseilles opened about 9 years ago.*9 com ments`, `Open.*marseilles opened about 9 years ago.*9 com ments`,
`8 \x{1f615} • 7 \x{1f440} • 6 \x{2764}\x{fe0f} • 5 \x{1f389} • 4 \x{1f604} • 3 \x{1f680} • 2 \x{1f44e} • 1 \x{1f44d}`, `8 \x{1f615} • 7 \x{1f440} • 6 \x{2764}\x{fe0f} • 5 \x{1f389} • 4 \x{1f604} • 3 \x{1f680} • 2 \x{1f44e} • 1 \x{1f44d}`,
`Assignees:.*marseilles, monaco\n`, `Assignees:.*marseilles, monaco\n`,
`Labels:.*one, two, three, four, five\n`, `Labels:.*one, two, three, four, five\n`,
`Projects:.*Project 1 \(column A\), Project 2 \(c olumn B\), Project 3 \(column C\), Project 4 \(Awaiting triage\)\n`, `Projects:.*Project 1 \(column A\), Project 2 \(c olumn B\), Project 3 \(column C\), Project 4 \(Awaiting triage\)\n`,
`Milestone:.*uluru\n`, `Milestone:.*uluru\n`,
`bold story`, `bold story`,
`View this issue on GitHub: https://github.com/OW NER/REPO/issues/123`, `View this issue on GitHub: https://github.com/OW NER/REPO/issues/123`,
}, },
}, },
"Open issue with empty body": { "Open issue with empty body": {
fixture: "./fixtures/issueView_previewWithEmptyBody.json" , fixture: "./fixtures/issueView_previewWithEmptyBody.json" ,
expectedOutputs: []string{ expectedOutputs: []string{
`ix of coins`, `ix of coins #123`,
`Open.*marseilles opened about 9 years ago.*9 com ments`, `Open.*marseilles opened about 9 years ago.*9 com ments`,
`No description provided`, `No description provided`,
`View this issue on GitHub: https://github.com/OW NER/REPO/issues/123`, `View this issue on GitHub: https://github.com/OW NER/REPO/issues/123`,
}, },
}, },
"Closed issue": { "Closed issue": {
fixture: "./fixtures/issueView_previewClosedState.json", fixture: "./fixtures/issueView_previewClosedState.json",
expectedOutputs: []string{ expectedOutputs: []string{
`ix of coins`, `ix of coins #123`,
`Closed.*marseilles opened about 9 years ago.*9 c omments`, `Closed.*marseilles opened about 9 years ago.*9 c omments`,
`bold story`, `bold story`,
`View this issue on GitHub: https://github.com/OW NER/REPO/issues/123`, `View this issue on GitHub: https://github.com/OW NER/REPO/issues/123`,
}, },
}, },
} }
for name, tc := range tests { for name, tc := range tests {
t.Run(name, func(t *testing.T) { t.Run(name, func(t *testing.T) {
io, _, stdout, stderr := iostreams.Test() io, _, stdout, stderr := iostreams.Test()
io.SetStdoutTTY(true) io.SetStdoutTTY(true)
skipping to change at line 313 skipping to change at line 317
fixtures map[string]string fixtures map[string]string
expectedOutputs []string expectedOutputs []string
wantsErr bool wantsErr bool
}{ }{
"without comments flag": { "without comments flag": {
cli: "123", cli: "123",
fixtures: map[string]string{ fixtures: map[string]string{
"IssueByNumber": "./fixtures/issueView_previewSin gleComment.json", "IssueByNumber": "./fixtures/issueView_previewSin gleComment.json",
}, },
expectedOutputs: []string{ expectedOutputs: []string{
`some title`, `some title #123`,
`some body`, `some body`,
`———————— Not showing 5 comments ————————`, `———————— Not showing 5 comments ————————`,
`marseilles \(Collaborator\) • Jan 1, 2020 • New est comment`, `marseilles \(Collaborator\) • Jan 1, 2020 • New est comment`,
`Comment 5`, `Comment 5`,
`Use --comments to view the full conversation`, `Use --comments to view the full conversation`,
`View this issue on GitHub: https://github.com/OW NER/REPO/issues/123`, `View this issue on GitHub: https://github.com/OW NER/REPO/issues/123`,
}, },
}, },
"with comments flag": { "with comments flag": {
cli: "123 --comments", cli: "123 --comments",
fixtures: map[string]string{ fixtures: map[string]string{
"IssueByNumber": "./fixtures/issueView_preview SingleComment.json", "IssueByNumber": "./fixtures/issueView_preview SingleComment.json",
"CommentsForIssue": "./fixtures/issueView_preview FullComments.json", "CommentsForIssue": "./fixtures/issueView_preview FullComments.json",
}, },
expectedOutputs: []string{ expectedOutputs: []string{
`some title`, `some title #123`,
`some body`, `some body`,
`monalisa • Jan 1, 2020 • Edited`, `monalisa • Jan 1, 2020 • Edited`,
`1 \x{1f615} • 2 \x{1f440} • 3 \x{2764}\x{fe0f} • 4 \x{1f389} • 5 \x{1f604} • 6 \x{1f680} • 7 \x{1f44e} • 8 \x{1f44d}`, `1 \x{1f615} • 2 \x{1f440} • 3 \x{2764}\x{fe0f} • 4 \x{1f389} • 5 \x{1f604} • 6 \x{1f680} • 7 \x{1f44e} • 8 \x{1f44d}`,
`Comment 1`, `Comment 1`,
`johnnytest \(Contributor\) • Jan 1, 2020`, `johnnytest \(Contributor\) • Jan 1, 2020`,
`Comment 2`, `Comment 2`,
`elvisp \(Member\) • Jan 1, 2020`, `elvisp \(Member\) • Jan 1, 2020`,
`Comment 3`, `Comment 3`,
`loislane \(Owner\) • Jan 1, 2020`, `loislane \(Owner\) • Jan 1, 2020`,
`Comment 4`, `Comment 4`,
skipping to change at line 389 skipping to change at line 393
"without comments flag": { "without comments flag": {
cli: "123", cli: "123",
fixtures: map[string]string{ fixtures: map[string]string{
"IssueByNumber": "./fixtures/issueView_previewSin gleComment.json", "IssueByNumber": "./fixtures/issueView_previewSin gleComment.json",
}, },
expectedOutputs: []string{ expectedOutputs: []string{
`title:\tsome title`, `title:\tsome title`,
`state:\tOPEN`, `state:\tOPEN`,
`author:\tmarseilles`, `author:\tmarseilles`,
`comments:\t6`, `comments:\t6`,
`number:\t123`,
`some body`, `some body`,
}, },
}, },
"with comments flag": { "with comments flag": {
cli: "123 --comments", cli: "123 --comments",
fixtures: map[string]string{ fixtures: map[string]string{
"IssueByNumber": "./fixtures/issueView_preview SingleComment.json", "IssueByNumber": "./fixtures/issueView_preview SingleComment.json",
"CommentsForIssue": "./fixtures/issueView_preview FullComments.json", "CommentsForIssue": "./fixtures/issueView_preview FullComments.json",
}, },
expectedOutputs: []string{ expectedOutputs: []string{
 End of changes. 11 change blocks. 
6 lines changed or deleted 11 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)