Skip to content

Commit 24acfb2

Browse files
authored
Refactor pullRequest destructuring in tests
1 parent ebfe9e1 commit 24acfb2

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

tests/site-with-errors.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ describe('site-with-errors', () => {
1616
})
1717

1818
it('cache has expected results', () => {
19-
const actual = results.map(({issue: {url: issueUrl}, pullRequest: {url: pullRequestUrl}, findings}) => {
19+
const actual = results.map(({issue: {url: issueUrl}, pullRequest, findings}) => {
20+
const pullRequestUrl = pullRequest?.url
2021
const {problemUrl, solutionLong, screenshotId, ...finding} = findings[0]
2122
// Check volatile fields for existence only
2223
expect(issueUrl).toBeDefined()
@@ -144,7 +145,8 @@ describe('site-with-errors', () => {
144145
)
145146
// Fetch pull requests referenced in the findings file
146147
pullRequests = await Promise.all(
147-
results.map(async ({pullRequest: {url: pullRequestUrl}}) => {
148+
results.map(async ({pullRequest}) => {
149+
const pullRequestUrl = pullRequest?.url
148150
expect(pullRequestUrl).toBeDefined()
149151
const {owner, repo, pullNumber} =
150152
/https:\/\/github\.com\/(?<owner>[^/]+)\/(?<repo>[^/]+)\/pull\/(?<pullNumber>\d+)/.exec(

0 commit comments

Comments
 (0)