(
testFn: (params: { userId: string }) => Promise<void>
)
| 107 | base_sha: baseSha, |
| 108 | sidebar_position: 'a0', |
| 109 | }) |
| 110 | .returning(); |
| 111 | expect(child).toMatchObject({ parent_worktree_id: parentId }); |
| 112 | await expect( |
| 113 | schemaTestDb.db.insert(schema.cloud_agent_worktrees).values({ |
| 114 | worktree_id: `workspace_${crypto.randomUUID()}`, |
| 115 | kilo_user_id: userId, |
| 116 | parent_worktree_id: `workspace_${crypto.randomUUID()}`, |
| 117 | }) |
| 118 | ).rejects.toMatchObject({ cause: { code: '23503' } }); |
| 119 | |
| 120 | await schemaTestDb.db |
| 121 | .delete(schema.cloud_agent_worktrees) |
| 122 | .where(eq(schema.cloud_agent_worktrees.worktree_id, parentId)); |
| 123 | const children = await schemaTestDb.db |
| 124 | .select() |
| 125 | .from(schema.cloud_agent_worktrees) |
| 126 | .where(eq(schema.cloud_agent_worktrees.worktree_id, childId)); |
| 127 | expect(children).toEqual([ |
| 128 | expect.objectContaining({ |
| 129 | parent_worktree_id: null, |
| 130 | base_branch: 'feature/parent', |
| 131 | base_sha: baseSha, |
| 132 | sidebar_position: 'a0', |
| 133 | }), |
no test coverage detected