agentleFS
LeanMeanCleanAppsLeanMeanCleanApps/CleanModelContextProtocol/.agents/skills/integration-tests/SKILL.md

integration-tests

Skill1 starsChanged 7 days agoMITView on GitHub

How integration tests run against a real SQLite database - a private in-memory database per repository test, and a per-test application host with its own database for presentation tests. Use when testing the repository, migrations, startup wiring or a real request through the presentation layer.

15 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use add-policy, tool-rename-deprecation and 2 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • OpenCortexIDESkill

    add-policy

    Use when adding, modifying, or reviewing VS Code configuration policies. Covers the full policy lifecycle from registration to export to platform-specific artifacts. Run on ANY change that adds a `policy:` field to a configuration property.

    Also in 4 projects that use this

  • gitpod-ioSkill

    tool-rename-deprecation

    Ensure renamed built-in tool references preserve backward compatibility. Use when renaming a toolReferenceName, tool set referenceName, or any tool identifier. Run on ANY change to tool registration code. Covers legacyToolReferenceFullNames for tools and legacyFullNames for tool sets.

    Also in 4 projects that use this

  • gitpod-ioSkill

    hygiene

    Use when making code changes to ensure they pass VS Code's hygiene checks. Covers the pre-commit hook, unicode restrictions, string quoting rules, copyright headers, indentation, formatting, ESLint, and stylelint. Run the hygiene check before declaring work complete.

    Also in 4 projects that use this

  • +1 more from gitpod-io

The file

We split this skill into the rules it gives an agent

2 rules. 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 14 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use the EF Core InMemory provider.

    line 62
  2. Very specific:

    Write to movie-reviews.db or any file.

    line 64

“Common” is measured: kept by at least 6 in 10 of the 14 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Integration tests

The rule

Integration tests use the real database engine, built from the real migrations, and every test gets its own database. No test can see another test's changes, and nothing is written to disk.

ProjectFixtureDatabase
tests/Infrastructure.Tests.IntegrationMovieReviewsTestDatabaseData Source=:memory: held open for one test, with the hand-written test data (sample-data) and a FakeTimeProvider fixed at 2009-12-31 23:51:01 UTC
tests/Presentation.Tests.IntegrationThe presentation layer's application host (a WebApplicationFactory<Program> in web templates, the Handler itself in Lambda)Data Source=Tests-{Guid};Mode=Memory;Cache=Shared with sample data on

Steps

  1. Repository tests: make the test class sealed and IDisposable, create private readonly MovieReviewsTestDatabase database = new(); and dispose it. Use this.database.Repository, and this.database.Context to find known rows.
  2. Find rows by their known values, not by position.
  3. For time-dependent results, assert against this.database.TimeProvider.
  4. Presentation tests: create a new application host per test class instance, pass settings in through its constructor, and make real requests (in Lambda, real calls to the handler). Assert the status code, then the body.
  5. Override settings in memory through the host's constructor, never by editing appsettings files or leaving environment variables set.
  6. The details of this template's application host are in presentation-integration-tests.

Example

// tests/Infrastructure.Tests.Integration/Databases/MovieReviews/EntityFrameworkMovieReviewsRepositoryTests.cs
public sealed class EntityFrameworkMovieReviewsRepositoryTests : IDisposable
{
    private readonly MovieReviewsTestDatabase database = new();

    public void Dispose()
    {
        this.database.Dispose();
    }

    [Fact]
    public async Task GetAuthorById_ShouldReturn_Author()
    {
        // Arrange
        var repository = this.database.Repository;
        using var tokenSource = new CancellationTokenSource();
        var token = tokenSource.Token;
        var author = this.database.Context.Authors.First(a => a.FirstName == "One");

        // Act
        var result = await repository.GetAuthorById(author.Id, token);

        // Assert
        _ = result.ShouldNotBeNull();
        result.Reviews.Count.ShouldBe(3);
    }
}

Don't

  • Use the EF Core InMemory provider. It isn't relational and lets through queries SQLite rejects.
  • Share one database across tests with IClassFixture or ICollectionFixture.
  • Write to movie-reviews.db or any file.
  • Depend on test order.

Check

dotnet test tests/Infrastructure.Tests.Integration
dotnet test tests/Presentation.Tests.Integration

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.