Skip to content

Commit 6d10f8c

Browse files
feat(api): request closed GitHub issues with state details
Agent-Logs-Url: https://github.com/conorheffron/ironoc/sessions/6b4e3309-774e-4662-ac5a-ac31e7e9824b Co-authored-by: conorheffron <8218626+conorheffron@users.noreply.github.com>
1 parent 20b80c8 commit 6d10f8c

4 files changed

Lines changed: 12 additions & 6 deletions

File tree

src/main/resources/application.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ net:
2222
endpoint:
2323
repos: https://api.github.com/users/{username}/repos?per_page={per_page}&page={page}
2424
user-ids-cache: conorheffron
25-
issues: https://api.github.com/repos/{username}/{repo}/issues?per_page={per_page}&page={page}&state=all
25+
issues: https://api.github.com/repos/{username}/{repo}/issues?per_page={per_page}&page={page}&state=closed
2626
projects-cache: >
2727
bio-cell-red-edge,
2828
booking-sys,

src/test/java/net/ironoc/portfolio/controller/GitProjectsControllerIntegrationTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public class GitProjectsControllerIntegrationTest extends BaseControllerIntegrat
8686
"or TypeScript as implementation language? \\r\\n- Research & select best option.\"," +
8787
"\"labels\":[]," +
8888
"\"number\":\"62\"," +
89-
"\"state\":null," +
89+
"\"state\":\"closed\"," +
9090
"\"title\":\"Re-write frontend with React <POC>\"" +
9191
"}," +
9292
"{" +
@@ -96,7 +96,7 @@ public class GitProjectsControllerIntegrationTest extends BaseControllerIntegrat
9696
"- [ ] 3. Setup domain, map to AWS LB\"," +
9797
"\"labels\":[]," +
9898
"\"number\":\"57\"," +
99-
"\"state\":null," +
99+
"\"state\":\"closed\"," +
100100
"\"title\":\"Setup LB, Support SSL\"" +
101101
"}" +
102102
"]";

src/test/java/net/ironoc/portfolio/service/GitDetailsServiceTest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public class GitDetailsServiceTest {
5151
private final ObjectMapper objectMapper = new ObjectMapper();
5252

5353
private static final String TEST_URI = "https://unittest.github.com/users/{username}/repos";
54-
private static final String TEST_ISSUES_URI = "https://unittest.github.com/repos/{username}/{repo}/issues?per_page={per_page}&page={page}&state=all";
54+
private static final String TEST_ISSUES_URI = "https://unittest.github.com/repos/{username}/{repo}/issues?per_page={per_page}&page={page}&state=closed";
5555

5656
@Test
5757
public void test_get_repos_success() throws IOException {
@@ -154,11 +154,13 @@ public void test_get_issues_success() throws IOException {
154154
assertThat(result.get().getNumber(), is(expected.getNumber()));
155155
assertThat(result.get().getTitle(), is(expected.getTitle()));
156156
assertThat(result.get().getBody(), is(expected.getBody()));
157+
assertThat(result.get().getState(), is("closed"));
157158
RepositoryIssueDto result2 = results.get(1);
158159
assertThat(result2.getNumber(), is("57"));
159160
assertThat(result2.getTitle(), is("Setup LB, Support SSL"));
160161
assertThat(result2.getBody(), is("- [x] 1. Setup LB\r\n- [ ] 2. " +
161162
"Support SSL\r\n- [ ] 3. Setup domain, map to AWS LB"));
163+
assertThat(result2.getState(), is("closed"));
162164
}
163165

164166
@Test
@@ -340,11 +342,13 @@ public void test_mapIssuesToResponse_success() throws IOException {
340342
assertThat(result.get().getTitle(), is("Re-write frontend with React <POC>"));
341343
assertThat(result.get().getBody(), is("Use React or Angular framework & JavaScript " +
342344
"or TypeScript as implementation language? \r\n- Research & select best option."));
345+
assertThat(result.get().getState(), is("closed"));
343346
RepositoryIssueDomain result2 = results.get(1);
344347
assertThat(result2.getNumber(), is("57"));
345348
assertThat(result2.getTitle(), is("Setup LB, Support SSL"));
346349
assertThat(result2.getBody(), is("- [x] 1. Setup LB\r\n- [ ] 2. " +
347350
"Support SSL\r\n- [ ] 3. Setup domain, map to AWS LB"));
351+
assertThat(result2.getState(), is("closed"));
348352
Assertions.assertNotNull(jsonInputStream);
349353
jsonInputStream.close();
350354
}

src/test/resources/json/test_issues_response.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
{
33
"number": "62",
44
"title": "Re-write frontend with React \u003CPOC\u003E",
5-
"body": "Use React or Angular framework & JavaScript or TypeScript as implementation language? \r\n- Research & select best option."
5+
"body": "Use React or Angular framework & JavaScript or TypeScript as implementation language? \r\n- Research & select best option.",
6+
"state": "closed"
67
},
78
{
89
"number": "57",
910
"title": "Setup LB, Support SSL",
10-
"body": "- [x] 1. Setup LB\r\n- [ ] 2. Support SSL\r\n- [ ] 3. Setup domain, map to AWS LB"
11+
"body": "- [x] 1. Setup LB\r\n- [ ] 2. Support SSL\r\n- [ ] 3. Setup domain, map to AWS LB",
12+
"state": "closed"
1113
}
1214
]

0 commit comments

Comments
 (0)