test: add tests for branches for handleBitbucketCloudRequest
Signed-off-by: Benjamin Janssens <benji.janssens@gmail.com>
This commit is contained in:
+14
@@ -35,6 +35,11 @@ describe('handleAutocompleteRequest', () => {
|
||||
.fn()
|
||||
.mockReturnValue([{ values: [{ slug: 'repository1' }] }]),
|
||||
}),
|
||||
listBranchesByRepository: jest.fn().mockReturnValue({
|
||||
iteratePages: jest
|
||||
.fn()
|
||||
.mockReturnValue([{ values: [{ name: 'branch1' }] }]),
|
||||
}),
|
||||
};
|
||||
|
||||
const fromConfig = jest
|
||||
@@ -89,6 +94,15 @@ describe('handleAutocompleteRequest', () => {
|
||||
expect(result).toEqual({ results: [{ title: 'repository1' }] });
|
||||
});
|
||||
|
||||
it('should return branches', async () => {
|
||||
const result = await handleBitbucketCloudRequest('foo', 'branches', {
|
||||
workspace: 'workspace1',
|
||||
repository: 'repository1',
|
||||
});
|
||||
|
||||
expect(result).toEqual(['branch1']);
|
||||
});
|
||||
|
||||
it('should throw an error when passing an invalid resource', async () => {
|
||||
await expect(
|
||||
handleAutocompleteRequest({
|
||||
|
||||
Reference in New Issue
Block a user