Skip to content

Commit

Permalink
fix: Bitbucket fetcher test had unused code (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
wulmer authored Nov 20, 2024
1 parent a45d209 commit cc358b4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"level": "error"
},
"noUnreachable": {
"level": "off"
"level": "error"
}
},
"performance": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ describe('Git Fetcher BitBucket Branches', () => {
if (url.endsWith('start=0')) {
responseBodyToReturn = bitBucketBranchMultiPageResponse[0]
queriedFirstPage = true
} else if (url.endsWith('start=1')) {
} else if (url.endsWith('start=2')) {
responseBodyToReturn = bitBucketBranchMultiPageResponse[1]
queriedSecondPage = true
} else {
Expand All @@ -109,21 +109,20 @@ describe('Git Fetcher BitBucket Branches', () => {
status: 200,
json: async () => responseBodyToReturn,
}

const result: BitbucketBranch[] =
(await gitFetcherBitBucketBranches.fetchResource()) as BitbucketBranch[]
expect(fetchMock).toBeCalledTimes(2)
expect(consoleSpy).toBeCalledWith('Fetched 2 branches')
expect(queriedFirstPage).toBe(true)
expect(queriedSecondPage).toBe(true)
expect(result).toHaveLength(2)
expect(result).toEqual([
...bitBucketBranchMultiPageResponse[0].values,
...bitBucketBranchMultiPageResponse[1].values,
])

expect(responseStatusHandlerSpy).toBeCalledTimes(0)
})
const result: BitbucketBranch[] =
(await gitFetcherBitBucketBranches.fetchResource()) as BitbucketBranch[]
expect(fetchMock).toBeCalledTimes(2)
expect(consoleSpy).toBeCalledWith('Fetched 4 branches')
expect(queriedFirstPage).toBe(true)
expect(queriedSecondPage).toBe(true)
expect(result).toHaveLength(4)
expect(result).toEqual([
...bitBucketBranchMultiPageResponse[0].values,
...bitBucketBranchMultiPageResponse[1].values,
])

expect(responseStatusHandlerSpy).toBeCalledTimes(0)
})

it.each([400, 401, 403, 500])(
Expand Down

0 comments on commit cc358b4

Please sign in to comment.