5. Tests and checks

The tests a domain needs

TestWhereWhat it proves
The entity's invariantsBlouppy.Projects.Models.UnitTestsA blank name is refused; a new project is planned; MarkAsCreated raises the event
The service and validatorsBlouppy.Projects.UnitTestsWith mocked ports: a valid creation adds the project; an unknown workspace returns an error
The registrationBlouppy.Projects.UnitTests/ProjectsDomainRegistrationTests.csAddProjectsDomain() resolves the service and its validators from a real container
The repositoriesBlouppy.Infrastructure.Database.IntegrationTests/Projects/Against PostgreSQL in a container, with separate contexts to arrange, act and assert
The controller's rightsBlouppy.Web.IntegrationTestsOne AuthorizationCases theory per route: a Viewer gets 403 on a write
The pageproject-list.component.spec.tsVitest, with provideTranslocoTesting() so a missing key fails

The conventions: Should_[action]_when_[condition], Arrange / Act / Assert comments, TestContext.Current.CancellationToken everywhere, and .BeEquivalentTo() against a typed expected object, never an anonymous one.

[Fact]
public async Task Should_return_an_error_when_the_workspace_does_not_exist()
{
    // Arrange
    _workspacesPublicDataServiceMock
        .Setup(x => x.TryGetOrganizationIdAsync(It.IsAny<WorkspaceId>(), It.IsAny<CancellationToken>()))
        .ReturnsAsync((OrganizationId?)null);

    var creation = new ProjectCreation(Name: "Website redesign", WorkspaceId: new WorkspaceId(12));

    // Act
    var result = await _sut.TryAddAsync(creation, TestContext.Current.CancellationToken);

    // Assert
    result.Failed.Should().BeTrue();
}

The architecture tests

Add the domain to the Domains table of Blouppy.Architecture.UnitTests/Architecture/DomainBoundaryTests.cs. From then on the build refuses a reference from Projects to another domain's implementation or models (Blouppy.Workspaces.PublicData stays allowed), to the infrastructure adapters or to the Web — and a public type outside .Abstractions.

Before the pull request

dotnet build back/        # warnings are errors
dotnet test back/

cd front/application
npm run lint && npm run format-check
npm test
npm run build && npm run gallery

A change that reaches across the whole graph — the gateway, the identity host, the bus — deserves the end-to-end suite too: in CI, add the e2e 🧪 label to the pull request.