From 9169c8d0eb438011e508a11eea17e7db34022e8b Mon Sep 17 00:00:00 2001 From: Toshiya Doi Date: Wed, 8 Apr 2020 14:48:08 +0900 Subject: [PATCH] Update unit tests for issue metadata --- command/issue_test.go | 22 +---- .../issueView_previewWithLotsOfMetadata.json | 95 ------------------- .../issueView_previewWithMetadata.json | 30 +++++- 3 files changed, 28 insertions(+), 119 deletions(-) delete mode 100644 test/fixtures/issueView_previewWithLotsOfMetadata.json diff --git a/command/issue_test.go b/command/issue_test.go index 1d5b2db33..0f2befcb8 100644 --- a/command/issue_test.go +++ b/command/issue_test.go @@ -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`, }, diff --git a/test/fixtures/issueView_previewWithLotsOfMetadata.json b/test/fixtures/issueView_previewWithLotsOfMetadata.json deleted file mode 100644 index 3753bd209..000000000 --- a/test/fixtures/issueView_previewWithLotsOfMetadata.json +++ /dev/null @@ -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" - } - } - } -} diff --git a/test/fixtures/issueView_previewWithMetadata.json b/test/fixtures/issueView_previewWithMetadata.json index 853d5f6a9..a7c21af59 100644 --- a/test/fixtures/issueView_previewWithMetadata.json +++ b/test/fixtures/issueView_previewWithMetadata.json @@ -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"