Storybooks for commit 6ae7364f5b518e97c387d6ca451561a57a12c04c

Date
8/25/2026, 6:59:06 PM UTC
Summary
fix(tests): drop throwaway MySQL schemas after integration suites
Description
## Because

- `testAccountDatabaseSetup` creates a `testAccount-<uuid>` schema for each spec file and never drops it. Closing the pool does not drop a schema.
- A local MySQL gains one schema per spec file per run. One developer machine held 184 of them before anyone noticed. CI is not affected.

## This pull request

- Adds `testAccountDatabaseTeardown(db?)` to `tests.ts` and exports it. The helper reads its own schema with `SELECT DATABASE()`. It drops that schema only when the name starts with `testAccount-`, then closes the pool in a `finally`.
- Calls the teardown from `afterAll` in the 12 `.in.spec.ts` files that call the setup. Jest runs `afterAll` for failing runs too, so those runs also clean up.
- Sweeps `testAccount-*` schemas older than 3 hours at the start of the setup, from `information_schema.TABLES.CREATE_TIME`. This covers a crash or a Ctrl-C, where no hook runs. The sweep is age based, so a concurrent run keeps its schema.
- Moves the hook in `backup-code.manager.in.spec.ts` to `afterEach`. That file calls the setup in `beforeEach`, so `afterAll` still left four schemas per run.
- Adds `tests.spec.ts`, a unit spec for the `testAccount-` guard. It mocks the `kysely` `sql` tag, so the spec needs no MySQL.

## Issue that this pull request solves

Closes: https://mozilla-hub.atlassian.net/browse/FXA-14412