Update unit tests for issue metadata

This commit is contained in:
Toshiya Doi 2020-04-08 14:48:08 +09:00
parent 24fcc69f9e
commit 9169c8d0eb
3 changed files with 28 additions and 119 deletions

View file

@ -299,7 +299,6 @@ func TestIssueView_Preview(t *testing.T) {
expectedOutputs: []string{
`ix of coins`,
`Open • marseilles opened about 292 years ago • 9 comments`,
`Participants: marseilles\n`,
`bold story`,
`View this issue on GitHub: https://github.com/OWNER/REPO/issues/123`,
},
@ -312,26 +311,9 @@ func TestIssueView_Preview(t *testing.T) {
`ix of coins`,
`Open • marseilles opened about 292 years ago • 9 comments`,
`Assignees: marseilles, monaco\n`,
`Labels: one, two, three\n`,
`Projects: The GitHub CLI \(to do list\)\n`,
`Labels: one, two, three, four, five\n`,
`Projects: Project 1 \(column A\), Project 2 \(column B\), Project 3 \(column C\)\n`,
`Milestone: uluru\n`,
`Participants: marseilles, monaco, montpellier\n`,
`bold story`,
`View this issue on GitHub: https://github.com/OWNER/REPO/issues/123`,
},
},
"Open issue with lots of metadata": {
ownerRepo: "master",
command: "issue view 123",
fixture: "../test/fixtures/issueView_previewWithLotsOfMetadata.json",
expectedOutputs: []string{
`ix of coins`,
`Open • marseilles opened about 292 years ago • 9 comments\n`,
`Assignees: marseilles, monaco, montpellier, …\n`,
`Labels: one, two, three, …\n`,
`Projects: Project 1 \(column A\), Project 2 \(column B\), Project 3 \(column C\), …\n`,
`Milestone: uluru\n`,
`Participants: marseilles, monaco, montpellier, …\n`,
`bold story`,
`View this issue on GitHub: https://github.com/OWNER/REPO/issues/123`,
},

View file

@ -1,95 +0,0 @@
{
"data": {
"repository": {
"hasIssuesEnabled": true,
"issue": {
"number": 123,
"body": "**bold story**",
"title": "ix of coins",
"state": "OPEN",
"created_at": "2011-01-26T19:01:12Z",
"author": {
"login": "marseilles"
},
"assignees": {
"nodes": [
{
"login": "marseilles"
},
{
"login": "monaco"
},
{
"login": "montpellier"
}
],
"totalcount": 4
},
"labels": {
"nodes": [
{
"name": "one"
},
{
"name": "two"
},
{
"name": "three"
}
],
"totalcount": 4
},
"projectcards": {
"nodes": [
{
"project": {
"name": "Project 1"
},
"column": {
"name": "column A"
}
},
{
"project": {
"name": "Project 2"
},
"column": {
"name": "column B"
}
},
{
"project": {
"name": "Project 3"
},
"column": {
"name": "column C"
}
}
],
"totalcount": 4
},
"milestone": {
"title": "uluru"
},
"participants": {
"nodes": [
{
"login": "marseilles"
},
{
"login": "monaco"
},
{
"login": "montpellier"
}
],
"totalcount": 4
},
"comments": {
"totalcount": 9
},
"url": "https://github.com/OWNER/REPO/issues/123"
}
}
}
}

View file

@ -32,22 +32,44 @@
},
{
"name": "three"
},
{
"name": "four"
},
{
"name": "five"
}
],
"totalcount": 3
"totalcount": 5
},
"projectcards": {
"nodes": [
{
"project": {
"name": "The GitHub CLI"
"name": "Project 1"
},
"column": {
"name": "to do list"
"name": "column A"
}
},
{
"project": {
"name": "Project 2"
},
"column": {
"name": "column B"
}
},
{
"project": {
"name": "Project 3"
},
"column": {
"name": "column C"
}
}
],
"totalcount": 1
"totalcount": 3
},
"milestone": {
"title": "uluru"