Remove merge-derived redemption test from ChatInviteTests
This commit is contained in:
parent
1ad80b6849
commit
f6ca1188a9
1 changed files with 0 additions and 33 deletions
|
|
@ -327,36 +327,3 @@ public sealed class ChatInvitePostTests(TestWebApplicationFactory factory) : ICl
|
|||
Assert.False(big.Headers.Contains("Set-Cookie"));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Redemption asks the same question as every other decision: an account already invited through a merge spends no second invite.</summary>
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue