Skip to main content

Welcome to Suites

Suites is an opinionated, flexible testing meta-framework aimed at elevating the software testing experience within backend systems working with dependency injection (DI) frameworks.

Suites provides a unified testing experience that combines best practices, industry standards, and a wide range of testing tools to help developers create robust, maintainable, and scalable test suites, thereby ensuring the development of high-quality software.

Zero-Setup, Automatic Mocking

Automatically generate mock objects, eliminate manual setup and reduce boilerplate code of your unit tests

Scale Your Test Suites

Suites' flexible architecture supports projects of all sizes, from small microservices to large monoliths

Supported Mocking Libraries and Dependency Injection Frameworks

Suites works seamlessly with popular mocking libraries and dependency injection frameworks. This means that you can leverage the full power of these libraries and frameworks while enjoying the convenience and flexibility that Suites provides.

Jest
Sinon
Vitest
NestJS
Inversify

Fluent and Convenient API for Unit Testing

Suites offers a fluent, convenient, and semantic API that makes writing tests a pleasure. The intuitive design of the API ensures that you can quickly set up your tests and focus on verifying the behavior of your application.

user.service.spec.ts
import { TestBed, Mocked } from '@suites/unit';

describe('User Service Unit Spec', () => {
let underTest: UserService; // 🧪 Declare the unit under test
let userApi: Mocked<UserApi>; // 🎭 Declare a mocked dependency

beforeAll(async () => {
// 🚀 Create an isolated test env for the unit (under test) + auto generated mock objects
const { unit, unitRef } = await TestBed.solitary(UserService).compile();

underTest = unit;

// 🔍 Retrieve a dependency (mock) from the unit
userApi = unitRef.get(UserApi);

// ✅ Test test test
it('should generate a random user and save to the database', async () => {
userApi.getRandom.mockResolvedValue({id: 1, name: 'John'} as User);
await underTest.generateRandomUser();
expect(database.saveUser).toHaveBeenCalledWith(userFixture);
});
});
}

Getting Started

Ready to get started with Suites? Check out the documentation overview to learn more about Suites and how you can use it to improve your testing experience.