From e2e7d30701add03a9f6682c1976f4ec32326c77c Mon Sep 17 00:00:00 2001 From: Leonid Pershin Date: Thu, 20 Aug 2026 14:04:35 +0300 Subject: [PATCH] Tighten layer graph tests and document npm test typecheck. Content and People/Schedule/Ai now fail the same way if they grow a game-layer edge the projects.md graph forbids; README matches the tsc-then-vitest script from phase 57. --- README.md | 3 ++- src/HSchool.Client/scripts/npm-test.test.ts | 4 ++++ .../LayerBoundaryTests.cs | 20 +++++++++++++++++-- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index cc46fbe..2ac1521 100644 --- a/README.md +++ b/README.md @@ -107,7 +107,8 @@ dotnet test npm --prefix src/HSchool.Client test ``` -Vitest covers the client codec, the calendar formatting and the RU/EN dictionaries. +`npm test` runs `tsc -b` then Vitest (codec, calendar formatting, RU/EN dictionaries). A duplicate +key in `strings.ts` fails typecheck without `npm run build`. `test:watch` is Vitest only. ## Layout diff --git a/src/HSchool.Client/scripts/npm-test.test.ts b/src/HSchool.Client/scripts/npm-test.test.ts index 15fd606..53a39c0 100644 --- a/src/HSchool.Client/scripts/npm-test.test.ts +++ b/src/HSchool.Client/scripts/npm-test.test.ts @@ -33,6 +33,10 @@ describe('npm test script', () => { it('does not depend on the hschool-client file: loop', () => { expect(pkg.dependencies?.['hschool-client']).toBeUndefined(); }); + + it('keeps build as typecheck then vite, without the file: loop', () => { + expect(pkg.scripts.build).toBe('tsc -b && vite build'); + }); }); describe('duplicate dictionary keys', () => { diff --git a/tests/HSchool.Architecture.Tests/LayerBoundaryTests.cs b/tests/HSchool.Architecture.Tests/LayerBoundaryTests.cs index 4bb4e6d..f7b1ba9 100644 --- a/tests/HSchool.Architecture.Tests/LayerBoundaryTests.cs +++ b/tests/HSchool.Architecture.Tests/LayerBoundaryTests.cs @@ -40,11 +40,14 @@ public class LayerBoundaryTests } [Fact] - public void Content_DoesNotReferenceArchAspNetSocketsProtocolOrSimulation() + public void Content_DoesNotReferenceArchAspNetSocketsProtocolPeopleScheduleAiOrSimulation() { var names = References(typeof(MapLayout)); AssertNoArchAspNetOrSockets(names); Assert.DoesNotContain("HSchool.Protocol", names, StringComparer.Ordinal); + Assert.DoesNotContain("HSchool.People", names, StringComparer.Ordinal); + Assert.DoesNotContain("HSchool.Schedule", names, StringComparer.Ordinal); + Assert.DoesNotContain("HSchool.Ai", names, StringComparer.Ordinal); Assert.DoesNotContain("HSchool.Simulation", names, StringComparer.Ordinal); } @@ -54,7 +57,10 @@ public class LayerBoundaryTests [InlineData(typeof(WalkGraph))] public void PeopleScheduleAi_DoNotReferenceArchAspNetOrSockets(Type marker) { - AssertNoArchAspNetOrSockets(References(marker)); + var names = References(marker); + AssertNoArchAspNetOrSockets(names); + Assert.DoesNotContain("HSchool.Protocol", names, StringComparer.Ordinal); + Assert.DoesNotContain("HSchool.Simulation", names, StringComparer.Ordinal); } [Fact] @@ -83,6 +89,16 @@ public class LayerBoundaryTests } } + [Fact] + public void ArchitectureTests_DoNotReferenceHostOrNetArchTest() + { + var csproj = File.ReadAllText( + Path.Combine(RepoRoot(), "tests", "HSchool.Architecture.Tests", "HSchool.Architecture.Tests.csproj")); + Assert.DoesNotContain("HSchool.Server", csproj, StringComparison.Ordinal); + Assert.DoesNotContain("HSchool.AppHost", csproj, StringComparison.Ordinal); + Assert.DoesNotContain("NetArchTest", csproj, StringComparison.OrdinalIgnoreCase); + } + [Fact] public void PeopleAiScheduleSimulationTests_NoLongerCarryLayerBans() {