@@ -110,6 +110,107 @@ void main() {
110
110
expect (checkRun.conclusion, CheckRunConclusion .neutral);
111
111
});
112
112
113
+ test ('CheckRun fromJson for skipped conclusion' , () {
114
+ /// The checkRun Json is the official Github values
115
+ ///
116
+ /// Github api url: https://docs.github.com/en/rest/reference/checks#get-a-check-run
117
+ const checkRunJson = '''{
118
+ "id": 10,
119
+ "head_sha": "ce587453ced02b1526dfb4cb910479d431683101",
120
+ "node_id": "MDg6Q2hlY2tSdW40",
121
+ "external_id": "",
122
+ "url": "https://api.github.com/repos/github/hello-world/check-runs/4",
123
+ "html_url": "https://github.com/github/hello-world/runs/4",
124
+ "details_url": "https://example.com",
125
+ "status": "completed",
126
+ "conclusion": "skipped",
127
+ "started_at": "2018-05-04T01:14:52Z",
128
+ "completed_at": "2018-05-04T01:14:52Z",
129
+ "output": {
130
+ "title": "Mighty Readme report",
131
+ "summary": "There are 0 failures, 2 warnings, and 1 notice.",
132
+ "text": "You may have some misspelled words on lines 2 and 4. You also may want to add a section in your README about how to install your app.",
133
+ "annotations_count": 2,
134
+ "annotations_url": "https://api.github.com/repos/github/hello-world/check-runs/4/annotations"
135
+ },
136
+ "name": "mighty_readme",
137
+ "check_suite": {
138
+ "id": 5
139
+ },
140
+ "app": {
141
+ "id": 1,
142
+ "slug": "octoapp",
143
+ "node_id": "MDExOkludGVncmF0aW9uMQ==",
144
+ "owner": {
145
+ "login": "github",
146
+ "id": 1,
147
+ "node_id": "MDEyOk9yZ2FuaXphdGlvbjE=",
148
+ "url": "https://api.github.com/orgs/github",
149
+ "repos_url": "https://api.github.com/orgs/github/repos",
150
+ "events_url": "https://api.github.com/orgs/github/events",
151
+ "avatar_url": "https://github.com/images/error/octocat_happy.gif",
152
+ "gravatar_id": "",
153
+ "html_url": "https://github.com/octocat",
154
+ "followers_url": "https://api.github.com/users/octocat/followers",
155
+ "following_url": "https://api.github.com/users/octocat/following{/other_user}",
156
+ "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
157
+ "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
158
+ "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
159
+ "organizations_url": "https://api.github.com/users/octocat/orgs",
160
+ "received_events_url": "https://api.github.com/users/octocat/received_events",
161
+ "type": "User",
162
+ "site_admin": true
163
+ },
164
+ "name": "Octocat App",
165
+ "description": "",
166
+ "external_url": "https://example.com",
167
+ "html_url": "https://github.com/apps/octoapp",
168
+ "created_at": "2017-07-08T16:18:44-04:00",
169
+ "updated_at": "2017-07-08T16:18:44-04:00",
170
+ "permissions": {
171
+ "metadata": "read",
172
+ "contents": "read",
173
+ "issues": "write",
174
+ "single_file": "write"
175
+ },
176
+ "events": [
177
+ "push",
178
+ "pull_request"
179
+ ]
180
+ },
181
+ "pull_requests": [
182
+ {
183
+ "url": "https://api.github.com/repos/github/hello-world/pulls/1",
184
+ "id": 1934,
185
+ "number": 3956,
186
+ "head": {
187
+ "ref": "say-hello",
188
+ "sha": "3dca65fa3e8d4b3da3f3d056c59aee1c50f41390",
189
+ "repo": {
190
+ "id": 526,
191
+ "url": "https://api.github.com/repos/github/hello-world",
192
+ "name": "hello-world"
193
+ }
194
+ },
195
+ "base": {
196
+ "ref": "master",
197
+ "sha": "e7fdf7640066d71ad16a86fbcbb9c6a10a18af4f",
198
+ "repo": {
199
+ "id": 526,
200
+ "url": "https://api.github.com/repos/github/hello-world",
201
+ "name": "hello-world"
202
+ }
203
+ }
204
+ }
205
+ ]
206
+ }''' ;
207
+ final checkRun = CheckRun .fromJson (jsonDecode (checkRunJson));
208
+
209
+ expect (checkRun.id, 10 );
210
+ expect (checkRun.name, 'mighty_readme' );
211
+ expect (checkRun.conclusion, CheckRunConclusion .skipped);
212
+ });
213
+
113
214
test ('CheckRun toString' , () {
114
215
// indirectly tests the toJson method as well.
115
216
final checkRun = CheckRun .fromJson (jsonDecode (checkRunJson));
0 commit comments