Skip to content

chore: use isolated test database instead of dev DB #275

@Flo0806

Description

@Flo0806

Problem

All unit tests currently use getDb() which connects to the development database (data/dm-hero.db). While tests create their own campaigns and clean up after themselves, this is risky - a bug in cleanup could corrupt dev data.

Solution

Create a getTestDb() utility that:

  • Creates a separate in-memory or temp-file SQLite database
  • Runs all migrations on it
  • Returns the isolated DB instance

Then migrate all existing test files to use getTestDb() instead of getDb().

Files affected

All files in packages/app/test/unit/ that import getDb from server/utils/db.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions