diff --git a/libs/user/domain/src/lib/user.repository.spec.ts b/libs/user/domain/src/lib/user.repository.spec.ts index b8d7397..f3be2c5 100644 --- a/libs/user/domain/src/lib/user.repository.spec.ts +++ b/libs/user/domain/src/lib/user.repository.spec.ts @@ -10,10 +10,6 @@ class MockUserRepository implements UserRepository { async findById(id: string): Promise { return this.users.find((user) => user.id === id) || null; } - - async findAll(): Promise { - return this.users; - } } describe('UserRepository', () => { @@ -33,11 +29,4 @@ describe('UserRepository', () => { expect(user).toBeNull(); }); - test('findAll should return all users', async () => { - const users = await userRepository.findAll(); - expect(users).toEqual([ - { id: '1', name: 'John Doe' }, - { id: '2', name: 'Jane Doe' }, - ]); - }); }); diff --git a/libs/user/domain/src/lib/user.repository.ts b/libs/user/domain/src/lib/user.repository.ts index 45e63c9..0712d58 100644 --- a/libs/user/domain/src/lib/user.repository.ts +++ b/libs/user/domain/src/lib/user.repository.ts @@ -2,5 +2,4 @@ import { User } from './user.entity'; export interface UserRepository { findById(id: string): Promise; - findAll(): Promise; } \ No newline at end of file diff --git a/libs/user/usecase/src/lib/get-user.usecase.spec.ts b/libs/user/usecase/src/lib/get-user.usecase.spec.ts index d218c9a..0b2ae94 100644 --- a/libs/user/usecase/src/lib/get-user.usecase.spec.ts +++ b/libs/user/usecase/src/lib/get-user.usecase.spec.ts @@ -8,7 +8,6 @@ describe('GetUserUsecase', () => { beforeEach(() => { userRepository = { findById: jest.fn(), - findAll: jest.fn(), } as unknown as jest.Mocked; getUserUsecase = new GetUserUsecase(userRepository); @@ -34,16 +33,4 @@ describe('GetUserUsecase', () => { expect(userRepository.findById).toHaveBeenCalledWith('1'); }); }); - - describe('executeAll', () => { - it('should return all users', async () => { - const users = [{ id: '1', name: 'John Doe' }, { id: '2', name: 'Jane Doe' }]; - userRepository.findAll.mockResolvedValue(users); - - const result = await getUserUsecase.executeAll(); - - expect(result).toEqual(users); - expect(userRepository.findAll).toHaveBeenCalled(); - }); - }); }); \ No newline at end of file diff --git a/libs/user/usecase/src/lib/get-user.usecase.ts b/libs/user/usecase/src/lib/get-user.usecase.ts index 7251b7d..9012a7f 100644 --- a/libs/user/usecase/src/lib/get-user.usecase.ts +++ b/libs/user/usecase/src/lib/get-user.usecase.ts @@ -6,8 +6,4 @@ export class GetUserUsecase { async execute(id: string): Promise { return this.userRepository.findById(id); } - - async executeAll(): Promise { - return this.userRepository.findAll(); - } }