Test Framework

Nest includes a built-in test framework for validating workflows and agent behavior. Use it to ensure reliability and performance:

import { Test, TestingModule } from '@nestjs/testing';
import { MyService } from './my-service';

describe('Workflow Test', () => {
  let service: MyService;

  beforeEach(async () => {
    const module: TestingModule = await Test.createTestingModule({
      providers: [MyService],
    }).compile();

    service = module.get<MyService>(MyService);
  });

  it('should complete successfully', async () => {
    const result = await service.executeWorkflow();
    expect(result.success).toBe(true);
  });
});

Last updated