feat(ui): branch selectors in the GitLab merge request create form

This commit is contained in:
2026-08-16 16:27:48 +00:00
parent c25e16d093
commit d5dea0c004
18 changed files with 188 additions and 21 deletions
+23 -2
View File
@@ -490,7 +490,20 @@ describe('GitLab data routes', () => {
expect(response.body.diff).toContain('line two');
});
test('repo/branches returns branch names', async () => {
test('repo/branches returns branch names and the default branch', async () => {
scriptedFetch([
(url) => (matches(/\/repository\/branches\?/)(url)
? jsonResponse([{ name: 'main', default: true }, { name: 'feat/api' }])
: null),
]);
const app = createApp();
const response = await request(app).get('/api/gitlab/repo/branches?namespace=group&project=sub');
expect(response.status).toBe(200);
expect(response.body).toEqual({ branches: ['main', 'feat/api'], defaultBranch: 'main' });
});
test('repo/branches returns null defaultBranch when no branch is marked default', async () => {
scriptedFetch([
(url) => (matches(/\/repository\/branches\?/)(url)
? jsonResponse([{ name: 'main' }, { name: 'feat/api' }])
@@ -500,7 +513,15 @@ describe('GitLab data routes', () => {
const app = createApp();
const response = await request(app).get('/api/gitlab/repo/branches?namespace=group&project=sub');
expect(response.status).toBe(200);
expect(response.body).toEqual({ branches: ['main', 'feat/api'] });
expect(response.body).toEqual({ branches: ['main', 'feat/api'], defaultBranch: null });
});
test('repo/branches returns empty branches and null defaultBranch when not connected', async () => {
clearGitLabAuth();
const app = createApp();
const response = await request(app).get('/api/gitlab/repo/branches?namespace=group&project=sub');
expect(response.status).toBe(200);
expect(response.body).toEqual({ branches: [], defaultBranch: null });
});
test('repo/branches requires namespace and project', async () => {