diff --git a/tests/Bifrost.Web.Tests/ChatInviteTests.cs b/tests/Bifrost.Web.Tests/ChatInviteTests.cs index 022fbd5..bb7218b 100644 --- a/tests/Bifrost.Web.Tests/ChatInviteTests.cs +++ b/tests/Bifrost.Web.Tests/ChatInviteTests.cs @@ -327,36 +327,3 @@ public sealed class ChatInvitePostTests(TestWebApplicationFactory factory) : ICl Assert.False(big.Headers.Contains("Set-Cookie")); } } - -/// Redemption asks the same question as every other decision: an account already invited through a merge spends no second invite. -public sealed class ChatInviteDerivedRedemptionTests -{ - [Fact] - public async Task A_survivor_invited_through_a_merge_keeps_a_second_invite_unspent() - { - var world = new AccountMergeLedgerTests.World(); - var survivor = await world.AccountAsync("survivor", MembershipStatus.Authenticated); - var folded = await world.AccountAsync("folded", MembershipStatus.Authenticated); - await using (var seed = world.Db()) - { - (await seed.UserAccounts.SingleAsync(x => x.Id == folded.Id)).ChatInvitedAtUtc = new DateTimeOffset(2026, 11, 1, 9, 0, 0, TimeSpan.Zero); - await seed.SaveChangesAsync(); - } - - await world.CommitAsync(await world.MergeAsync(survivor, folded)); - - await using var db = world.Db(); - var service = new ChatInviteService(db, new Bifrost.Web.Features.Shared.AuditTrailService(db, world.Clock), world.Clock, - Microsoft.Extensions.Options.Options.Create(new Bifrost.Web.Configuration.BifrostHostOptions())); - var (invite, token) = await service.MintAsync(Guid.NewGuid(), "second", CancellationToken.None); - var http = new Microsoft.AspNetCore.Http.DefaultHttpContext(); - http.Request.Headers.Cookie = ChatInviteService.CookieName + "=" + token; - - await service.RedeemCarriedAsync(http, survivor.Id, CancellationToken.None); - - await using var read = world.Db(); - var row = await read.ChatInvites.AsNoTracking().SingleAsync(x => x.Id == invite.Id); - Assert.Null(row.RedeemedAtUtc); - Assert.Null((await read.UserAccounts.AsNoTracking().SingleAsync(x => x.Id == survivor.Id)).ChatInvitedAtUtc); - } -}