Path: redb-route/tests/redb.Route.Tests.JsonTransform/JsonTransformCacheKeyTests.cs Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route Page: https://redbase.app/src/dev-2026-12-06/redb-route/tests/redb.Route.Tests.JsonTransform/JsonTransformCacheKeyTests.cs ---- using redb.Route.Core; using redb.Route.JsonTransform; using redb.Route.TestKit; namespace redb.Route.Tests.JsonTransform; /// Code review 2026-09-01: the specification cache is keyed by the resolved file, not by the relative name. public class JsonTransformCacheKeyTests { [Fact] public async Task CompileCache_IsKeyedByTheResolvedFile_NotByTheRelativeName() { var a = Directory.CreateTempSubdirectory("redb-jsonata-a-"); var b = Directory.CreateTempSubdirectory("redb-jsonata-b-"); try { await System.IO.File.WriteAllTextAsync(Path.Combine(a.FullName, "s.jsonata"), "\"FROM-A\""); await System.IO.File.WriteAllTextAsync(Path.Combine(b.FullName, "s.jsonata"), "\"FROM-B\""); (await TransformFrom(a.FullName)).Should().Be("\"FROM-A\""); (await TransformFrom(b.FullName)).Should().Be("\"FROM-B\"", "a different base directory is a different specification"); await System.IO.File.WriteAllTextAsync(Path.Combine(a.FullName, "s.jsonata"), "\"EDITED-A\""); (await TransformFrom(a.FullName)).Should().Be("\"EDITED-A\"", "a new context compiles the edited file afresh"); } finally { a.Delete(recursive: true); b.Delete(recursive: true); } static async Task TransformFrom(string baseDirectory) { await using var ctx = new RouteContext(); ctx.UseJsonTransform(o => o.BaseDirectory = baseDirectory); ctx.AddRoutes(r => r.From("direct://k").TransformJson("s.jsonata")); await ctx.Start(); return await ctx.RequestBody("direct://k", "{}"); } } }