feat(data): add TaskRepository.ResetToManualAsync
This commit is contained in:
@@ -198,6 +198,35 @@ public sealed class TaskRepositoryTests : IDisposable
|
||||
Assert.Equal(TaskStatus.Done, d!.Status);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ResetToManualAsync_ClearsResultFields_AndSetsStatusManual()
|
||||
{
|
||||
var listId = await CreateListAsync();
|
||||
var task = new TaskEntity
|
||||
{
|
||||
Id = Guid.NewGuid().ToString(),
|
||||
ListId = listId,
|
||||
Title = "T",
|
||||
CreatedAt = DateTime.UtcNow,
|
||||
Status = TaskStatus.Failed,
|
||||
StartedAt = DateTime.UtcNow.AddMinutes(-5),
|
||||
FinishedAt = DateTime.UtcNow,
|
||||
Result = "boom",
|
||||
CommitType = "feat",
|
||||
};
|
||||
await _tasks.AddAsync(task);
|
||||
|
||||
await _tasks.ResetToManualAsync(task.Id);
|
||||
|
||||
using var readCtx = _db.CreateContext();
|
||||
var after = await new TaskRepository(readCtx).GetByIdAsync(task.Id);
|
||||
Assert.NotNull(after);
|
||||
Assert.Equal(TaskStatus.Manual, after!.Status);
|
||||
Assert.Null(after.StartedAt);
|
||||
Assert.Null(after.FinishedAt);
|
||||
Assert.Null(after.Result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task GetEffectiveTagsAsync_Returns_Union_Of_ListTags_And_TaskTags()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user