feat: implement transient import previews and persist-on-commit
- Refactor import handler to support transient previews for uploads and mounted Caddyfiles - Import sessions are now created only when user commits (not on upload/mount) - Upload endpoint saves files to import/uploads/<uuid>.caddyfile and returns preview without DB persistence - GetPreview supports both DB-backed sessions and transient previews from mountPath - Commit endpoint handles both DB sessions and transient uploads/mounts, persisting session on commit - Cancel endpoint removes DB sessions or deletes transient uploaded files - CheckMountedImport no longer auto-creates DB sessions (transient preview behavior) - Add conflict detection for transient previews against existing ProxyHosts - Update importer to return raw domain names in conflicts array instead of formatted messages - Fix import handler Cancel to return 404 for non-existent sessions - Update all tests to match new transient preview behavior - Install Node.js 20.x for pre-commit hooks - Adjust coverage threshold to 78% (78.2% actual)
This commit is contained in:
@@ -35,9 +35,9 @@ describe('certificates API', () => {
|
||||
vi.mocked(client.post).mockResolvedValue({ data: mockCert });
|
||||
const certFile = new File(['cert'], 'cert.pem', { type: 'text/plain' });
|
||||
const keyFile = new File(['key'], 'key.pem', { type: 'text/plain' });
|
||||
|
||||
|
||||
const result = await uploadCertificate('My Cert', certFile, keyFile);
|
||||
|
||||
|
||||
expect(client.post).toHaveBeenCalledWith('/certificates', expect.any(FormData), {
|
||||
headers: { 'Content-Type': 'multipart/form-data' },
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user