desfse

by trisna dev

JavaScript

// Test Example
describe('CreateUser Use Case', () => {
  it('should create a user successfully', async () => {
    const mockRepo = {
      save: jest.fn().mockResolvedValue({ id: 1, name: 'John' }),
    };
    const createUser = new CreateUser(mockRepo);
    const result = await createUser.execute({ id: 1, name: 'John' });

    expect(result.name).toBe('John');
    expect(mockRepo.save).toHaveBeenCalled();
  });
});