Implement meeting assistant v1

This commit is contained in:
2026-05-20 02:06:16 +02:00
parent 90df1edc03
commit 0297bcc0f6
120 changed files with 11883 additions and 180 deletions
+52 -1
View File
@@ -1,6 +1,12 @@
using System.Net;
using System.Net.Http.Json;
using MeetingAssistant.Recording;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.AspNetCore.TestHost;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
namespace MeetingAssistant.Tests;
@@ -10,7 +16,16 @@ public sealed class HealthEndpointTests : IClassFixture<WebApplicationFactory<Pr
public HealthEndpointTests(WebApplicationFactory<Program> factory)
{
this.factory = factory;
this.factory = factory.WithWebHostBuilder(builder =>
{
builder.ConfigureAppConfiguration((_, configuration) =>
{
configuration.AddInMemoryCollection(new Dictionary<string, string?>
{
["MeetingAssistant:FunAsr:Backend:Enabled"] = "false"
});
});
});
}
[Fact]
@@ -26,5 +41,41 @@ public sealed class HealthEndpointTests : IClassFixture<WebApplicationFactory<Pr
Assert.Equal("ok", body?.Status);
}
[Fact]
public async Task ApplicationStartupDeletesStaleTemporaryRecordings()
{
await using var cleanupFactory = factory.WithWebHostBuilder(builder =>
{
builder.ConfigureTestServices(services =>
{
services.RemoveAll<IRecordedAudioStore>();
services.AddSingleton<IRecordedAudioStore, StartupCleanupRecordedAudioStore>();
});
});
using var client = cleanupFactory.CreateClient();
using var response = await client.GetAsync("/health");
var store = cleanupFactory.Services.GetRequiredService<IRecordedAudioStore>() as StartupCleanupRecordedAudioStore;
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
Assert.True(store?.StaleRecordingsDeleted);
}
private sealed record HealthResponse(string Service, string Status);
private sealed class StartupCleanupRecordedAudioStore : IRecordedAudioStore
{
public bool StaleRecordingsDeleted { get; private set; }
public Task<IRecordedAudioSink> CreateSessionAsync(CancellationToken cancellationToken)
{
throw new NotSupportedException();
}
public Task DeleteStaleRecordingsAsync(CancellationToken cancellationToken)
{
StaleRecordingsDeleted = true;
return Task.CompletedTask;
}
}
}