test(data): parent delete with children is restricted
This commit is contained in:
@@ -283,6 +283,25 @@ public sealed class TaskRepositoryPlanningTests : IDisposable
|
|||||||
Assert.False(ok);
|
Assert.False(ok);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task DeleteAsync_ParentWithChildren_ThrowsOrDoesNotDelete()
|
||||||
|
{
|
||||||
|
var listId = await CreateListAsync();
|
||||||
|
var parent = MakeTask(listId, TaskStatus.Planning);
|
||||||
|
await _tasks.AddAsync(parent);
|
||||||
|
await _tasks.CreateChildAsync(parent.Id, "c", null, null, null);
|
||||||
|
|
||||||
|
// ExecuteDelete bypasses EF change tracking, so SQLite's FK enforcement
|
||||||
|
// (foreign_keys = ON, set by ClaudeDoDbContext) throws SqliteException directly.
|
||||||
|
await Assert.ThrowsAsync<Microsoft.Data.Sqlite.SqliteException>(async () =>
|
||||||
|
{
|
||||||
|
await _tasks.DeleteAsync(parent.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
var stillThere = await _tasks.GetByIdAsync(parent.Id);
|
||||||
|
Assert.NotNull(stillThere);
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task GetNextQueuedAgentTask_SkipsDraftPlanningPlanned()
|
public async Task GetNextQueuedAgentTask_SkipsDraftPlanningPlanned()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user