Add unit tests for MicCheck.Api.Features
Covers validators, response mapping, TagService/TagsController, FeaturesController (CRUD + tag assignment), FeatureSegmentService, FeatureStateService (incl. webhook dispatch), and FeatureUsageController. Fills gaps in FeatureService (FindByIdAsync, not-found exceptions). FeatureUsageFlushBackgroundService is marked [ExcludeFromCodeCoverage]: timer-driven, issues raw SQL through a DI-scoped concrete DbContext, can't be exercised cleanly without a live DB (CLAUDE.md disallows WebApplicationFactory/InMemory). Raises the namespace from 44% to 97%.
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using MicCheck.Api.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace MicCheck.Api.Features;
|
||||
|
||||
[ExcludeFromCodeCoverage(Justification = "Timer-driven BackgroundService that issues raw SQL through a DI-scoped concrete MicCheckDbContext; exercising it cleanly requires a live DB, which CLAUDE.md disallows (no WebApplicationFactory/InMemory). DrainAccumulated's bucketing logic is covered by FeatureUsageMetricsTests.")]
|
||||
public class FeatureUsageFlushBackgroundService(
|
||||
FeatureUsageMetrics metrics,
|
||||
IServiceScopeFactory scopeFactory,
|
||||
|
||||
Reference in New Issue
Block a user