test(ideas): cover workflow, application window and controller outcomes

Add unit tests for idea status transitions, granted application windows and applications controller status mapping (409 when call closed, 201 on success).
This commit is contained in:
Rafał Tyński
2026-10-04 03:13:50 +02:00
parent 127ca92f63
commit ded596d872
3 changed files with 155 additions and 0 deletions
@@ -0,0 +1,28 @@
using TarninaHub.Application.Abstractions;
using TarninaHub.Application.Dtos;
namespace TarninaHub.Tests.Stubs;
/// <summary>Minimal IIdeaService stub for controller tests.</summary>
public sealed class StubIdeaService : IIdeaService
{
public IdeaResponse? Idea { get; set; }
public Task<IdeaResponse> CreateAsync(string authorId, CreateIdeaRequest request, CancellationToken cancellationToken) =>
Task.FromResult(Idea ?? throw new InvalidOperationException());
public Task<IdeaResponse?> GetAsync(string ideaId, CancellationToken cancellationToken) =>
Task.FromResult(Idea);
public Task<IReadOnlyList<IdeaResponse>> ListForAuthorAsync(string authorId, CancellationToken cancellationToken) =>
Task.FromResult<IReadOnlyList<IdeaResponse>>(Idea is null ? [] : [Idea]);
public Task<IdeaResponse?> UpdateAsync(string ideaId, UpdateIdeaRequest request, CancellationToken cancellationToken) =>
Task.FromResult(Idea);
public Task<IdeaCardResponse?> GetCardAsync(string ideaId, CancellationToken cancellationToken) =>
Task.FromResult<IdeaCardResponse?>(null);
public Task<IdeaCardResponse?> UpdateCardAsync(string ideaId, IdeaCardRequest request, CancellationToken cancellationToken) =>
Task.FromResult<IdeaCardResponse?>(null);
}