Skip to main content
Glama
feature.spec.unit.ts1.13 kB
import { createBranch } from './feature'; import { AzureDevOpsError } from '../../../shared/errors'; describe('createBranch unit', () => { test('should create branch when source exists', async () => { const updateRefs = jest.fn().mockResolvedValue([{ success: true }]); const mockConnection: any = { getGitApi: jest.fn().mockResolvedValue({ getBranch: jest.fn().mockResolvedValue({ commit: { commitId: 'abc' } }), updateRefs, }), }; await createBranch(mockConnection, { projectId: 'p', repositoryId: 'r', sourceBranch: 'main', newBranch: 'feature', }); expect(updateRefs).toHaveBeenCalled(); }); test('should throw error when source branch missing', async () => { const mockConnection: any = { getGitApi: jest.fn().mockResolvedValue({ getBranch: jest.fn().mockResolvedValue(null), }), }; await expect( createBranch(mockConnection, { projectId: 'p', repositoryId: 'r', sourceBranch: 'missing', newBranch: 'feature', }), ).rejects.toThrow(AzureDevOpsError); }); });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Tiberriver256/mcp-server-azure-devops'

If you have feedback or need assistance with the MCP directory API, please join our Discord server