Add CultMesh multi-document latest helpers

This commit is contained in:
Meta Vens 2026-06-27 18:23:26 +01:00
commit 7bb6d7da8c
2 changed files with 80 additions and 0 deletions

View file

@ -736,6 +736,37 @@ public sealed class CultMeshStreamingTests
catalog.Latest<MeshNoteAliasDocument>().Text.Should().Be("catalog-primary");
}
[Test]
public async Task DocumentHelpers_ProjectLatestSnapshotsFromMultipleHandles()
{
var primary = CultMesh.Document(
"mesh.note.primary",
CultMesh.Verse("starbridge", "unity-pilot"),
_ => Task.FromResult(new MeshNoteDocument
{
Schema = "tests.mesh_note.v1",
Text = "alpha",
Revision = 3
}),
_ => new Subject<MeshNoteDocument>());
var secondary = CultMesh.Document(
"mesh.note.secondary",
CultMesh.Verse("starbridge", "unity-pilot"),
_ => Task.FromResult(new MeshOtherDocument
{
Schema = "tests.mesh_other.v1",
Text = "beta"
}),
_ => new Subject<MeshOtherDocument>());
var projected = await CultMesh.LatestAsync(
primary,
secondary,
(first, second) => $"{first.Text}:{first.Revision}:{second.Text}");
projected.Should().Be("alpha:3:beta");
}
[Test]
public async Task DocumentHandle_ReadsWatchesAndReplacesCultCacheRecords()
{