Aviary
Packages

@dudousxd/nestjs-media-testing

In-memory driver/store/session + reusable conformance suites.

Test doubles and contract suites. Use it to test your own code against fast in-memory implementations, and to verify custom drivers/stores behave exactly like the built-ins.

In-memory doubles

import {
  InMemoryDriver,
  InMemoryMediaStore,
  InMemoryUploadSessionStore,
} from '@dudousxd/nestjs-media-testing';

MediaModule.forRoot({
  default: 'mem',
  disks: { mem: new InMemoryDriver() },
  store: new InMemoryMediaStore(),
  uploadSessions: new InMemoryUploadSessionStore(),
});

Fast, dependency-free, and isolated per instance — ideal for unit tests of services that use MediaService, with no filesystem, database, or container.

Conformance suites

The same contracts every built-in driver and store is verified against, exported for your custom implementations:

import {
  runStorageDriverConformance,
  runMediaStoreConformance,
} from '@dudousxd/nestjs-media-testing';

runStorageDriverConformance('MyDriver', () => new MyDriver(/* … */));
runMediaStoreConformance('MyStore', () => new MyStore(/* … */));

Each registers a describe block exercising the full behavioral contract — round-trips, FileNotFoundError semantics, idempotent delete, ordering, nextOrder, and more. If your driver or store passes, it drops into the library unchanged.

This is how the built-ins stay honest: disk-s3 runs the storage suite against MinIO; the four ORM stores all run the store suite (in-memory, sqlite, and real Postgres). Your custom backend gets the same guarantee for free.

See Recipes → Custom driver and Custom store.

On this page