Skip to content

Fix GitJSONDSL and diffForFile for BitBucket Server - #764

Merged
orta merged 1 commit into
danger:masterfrom
langovoi:bitbucket-diff
Nov 15, 2018
Merged

orta merged 1 commit into
danger:masterfrom
langovoi:bitbucket-diff

Conversation

@langovoi

@langovoi langovoi commented Nov 14, 2018 •

Copy link
Copy Markdown
Contributor

Bitbucket Server API for diff sometimes return truncated: true in root of response.
This means that Bitbucket Server don't provide full diff of all files.

In my practical with Danger, this breaks modified_files, created_files and deleted_files.

Bitbucket Server has another API, which returns list of changes in PR, without diff.
I replaced diff API with changes API for generation GitJSONDSL.

Also I reworked diffForFile to fix potential bug with Bitbucket Server, when diff API may return truncated results.

@langovoi
langovoi requested a review from orta November 14, 2018 19:30
@langovoi

langovoi commented Nov 14, 2018 •

Copy link
Copy Markdown
Contributor Author

@orta could you review, please?


values = values.concat(data.values)
nextPageStart = data.nextPageStart
} while (nextPageStart !== null)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Collect all pages with changes

describe("API testing - BitBucket Server", () => {
let api: BitBucketServerAPI
let jsonResult: any
let jsonResult: () => any

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allowing to set jsonResult as function. For example for use jest.fn

nextPageStart: 1,
values: ["1"],
})
.mockReturnValueOnce({

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simulate iteration by pages

@orta

orta commented Nov 15, 2018

Copy link
Copy Markdown
Member

OK, cool, yeah this looks good 👍

@orta
orta merged commit 0afefa8 into danger:master Nov 15, 2018
@langovoi
langovoi deleted the bitbucket-diff branch November 15, 2018 11:38
@langovoi

Copy link
Copy Markdown
Contributor Author

Great! Could you make new release, please?

@orta

orta commented Nov 15, 2018

Copy link
Copy Markdown
Member

Yep, this came out in 6.1.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants