Bifrost/tests/Bifrost.Web.Tests/MigrationDiscoveryTests.cs
Meta Vens 83daabe512 Bifrost as OIDC issuer for the Matrix chat (gamecult-chat cut bifrost-oidc-issuer, squash of 1ef289a..ec4acfa and abd12b3..)
One configured client (stale clients removed with their tokens and authorizations), Active membership re-checked at token and userinfo through IsStillActiveMemberAsync, PKCE required by the server option, OpenIddict.Server.AspNetCore + EntityFrameworkCore 7.7.1 with no vulnerable transitives. Soul s2, s3 and s4 hold; Low conformance gaps in gamecult-chat:follow_up:oidc-issuer-spec-conformance.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 04:57:16 +01:00

58 lines
2 KiB
C#

using Bifrost.Web.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Bifrost.Web.Tests;
public sealed class MigrationDiscoveryTests
{
private static readonly string[] ExpectedMigrations =
[
"20260422084653_InitialAlphaFoundation",
"20260608210000_AddHeimdallUserIdentity",
"20260609143000_AddPatronSupportDerivation",
"20260609160000_AddExternalPatronProviderIntake",
"20260617010537_AddBridgeActionLedger",
"20260617022305_AddAgentDispatchRuns",
"20260617033635_AddAgentTransportReceipts",
"20260617041417_AddGovernanceActivityReceipts",
"20260622142000_AddBridgeActionIdentityProvenance",
"20260622165000_AddBifrostNativeIdentity",
"20260622202000_AddBridgeActionTargetSurfaceName",
"20260705190000_AddPatronSupportProjectAttribution",
"20261010043937_AddConceptVotes",
"20261022163159_AddOpenIddict",
];
// Database.GetMigrations() reads assembly metadata only; no connection is opened.
private static List<string> Discovered()
{
var options = new DbContextOptionsBuilder<BifrostDbContext>()
.UseNpgsql("Host=unused")
.Options;
using var db = new BifrostDbContext(options);
return db.Database.GetMigrations().ToList();
}
[Fact]
public void Every_migration_type_is_discovered()
{
var discovered = Discovered();
var declared = typeof(BifrostDbContext).Assembly.GetTypes()
.Where(t => !t.IsAbstract && typeof(Migration).IsAssignableFrom(t))
.ToList();
Assert.NotEmpty(declared);
Assert.Equal(declared.Count, discovered.Count);
foreach (var type in declared)
{
Assert.Contains(discovered, id => id.EndsWith("_" + type.Name, StringComparison.Ordinal));
}
}
[Fact]
public void All_fourteen_migrations_are_listed_in_order()
{
Assert.Equal(ExpectedMigrations, Discovered());
}
}