feat(coding): add project identity UX
This commit is contained in:
@@ -50,4 +50,53 @@ describe('coding project Host facade', () => {
|
||||
['/api/coding/conversations/conversation%2F1', { method: 'DELETE' }],
|
||||
]);
|
||||
});
|
||||
|
||||
it('sends explicit identity choices and a literal independent-copy confirmation', async () => {
|
||||
hostApiFetch
|
||||
.mockResolvedValueOnce({ snapshot: { project: { id: 'local-1' }, config: { projectId: 'aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa' }, knowledgeFiles: [] } })
|
||||
.mockResolvedValueOnce({ snapshot: { project: { id: 'local-1' }, config: { projectId: 'bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbbbbbb' }, knowledgeFiles: [] } })
|
||||
.mockResolvedValueOnce({ snapshot: { project: { id: 'local-1' }, config: { projectId: 'cccccccc-cccc-4ccc-8ccc-cccccccccccc' }, knowledgeFiles: [] } });
|
||||
const {
|
||||
createCodingProject,
|
||||
isCanonicalCodingProjectId,
|
||||
makeCodingProjectIndependentCopy,
|
||||
resolveCodingProjectIdentity,
|
||||
} = await import('@/lib/coding-projects');
|
||||
|
||||
await createCodingProject({
|
||||
projectPath: 'C:/projects/new',
|
||||
projectType: 'custom',
|
||||
identity: { kind: 'create' },
|
||||
});
|
||||
await resolveCodingProjectIdentity('local-1', {
|
||||
kind: 'bind',
|
||||
projectId: 'bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbbbbbb',
|
||||
});
|
||||
await makeCodingProjectIndependentCopy('local-1');
|
||||
|
||||
expect(isCanonicalCodingProjectId('bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbbbbbb')).toBe(true);
|
||||
expect(isCanonicalCodingProjectId('BBBBBBBB-BBBB-4BBB-8BBB-BBBBBBBBBBBB')).toBe(false);
|
||||
expect(isCanonicalCodingProjectId('not-a-project-id')).toBe(false);
|
||||
expect(hostApiFetch.mock.calls).toEqual([
|
||||
['/api/coding/projects/create', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
projectPath: 'C:/projects/new',
|
||||
projectType: 'custom',
|
||||
identity: { kind: 'create' },
|
||||
}),
|
||||
}],
|
||||
['/api/coding/projects/identity', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
localProjectId: 'local-1',
|
||||
identity: { kind: 'bind', projectId: 'bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbbbbbb' },
|
||||
}),
|
||||
}],
|
||||
['/api/coding/projects/identity/independent-copy', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ localProjectId: 'local-1', confirmed: true }),
|
||||
}],
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user