fix(clone): state the empty-target requirement in the already-has-files error

This commit is contained in:
Devvyn committed 2026-11-06 15:01:00 +08:00
1 parent ec4c901190
commit 51264ec0c0
2 files changed
+4 -4

No files matched your search

+1 -1
View File
@@ -748,7 +748,7 @@ export function registerCaseRoutes(
? ApiErrorCode.ALREADY_EXISTS
: ApiErrorCode.INVALID_INPUT,
prepared.code === 'EXISTS'
? `${customPath} already has files in it. Pick an empty folder, or a folder that does not exist yet.`
? `${customPath} already has files in it. The clone target must be empty or not exist yet.`
: prepared.reason
);
}
+3 -3
View File
@@ -33,7 +33,7 @@ function bootClone() {
const set = (id: string, value: string) => ((doc.getElementById(id) as HTMLInputElement).value = value);
set('cloneRepoUrl', 'https://github.com/opticon454/bifrost');
set('cloneCaseName', 'bifrost');
return { app, doc, set, fetchMock };
return { app, doc, set, fetchMock, win };
}
async function requestBody(fetchMock: ReturnType<typeof vi.fn>) {
@@ -88,13 +88,13 @@ describe('Clone Repo custom folder', () => {
});
it('previews the name taken from the URL as it is typed', () => {
const { app, doc, set } = bootClone();
const { app, doc, set, win } = bootClone();
app.isCliAvailable = () => true; // lives in settings-ui.js, which this test does not load
set('cloneCaseName', '');
set('cloneCasePath', '/mnt/projects');
set('cloneRepoUrl', 'https://github.com/opticon454/bifrost');
app.onCloneUrlInput();
clearTimeout(app._clonePreflightTimer);
win.clearTimeout(app._clonePreflightTimer);
expect((doc.getElementById('cloneCaseName') as HTMLInputElement).value).toBe('bifrost');
expect(doc.getElementById('cloneCasePathPreview')?.textContent).toBe('Will clone into: /mnt/projects/bifrost');
});