diff --git a/src/features/social-media/repositories/social-media.test.ts b/src/features/social-media/repositories/social-media.test.ts index d296371..a417379 100644 --- a/src/features/social-media/repositories/social-media.test.ts +++ b/src/features/social-media/repositories/social-media.test.ts @@ -3,7 +3,7 @@ import { prisma } from 'mocks/prisma'; import { SocialMediaRepository } from '@/features/social-media/repositories/social-media'; import { SocialMediaMock } from '@/shared/test-helpers/mocks/social-media.mock'; -describe('[Repositories] SocialMediaRepository', () => { +describe('[Service] SocialMediaRepository', () => { let repository: SocialMediaRepository; let socialMedias: any; diff --git a/src/shared/infra/email/services/email-service.test.ts b/src/shared/infra/email/services/email-service.test.ts new file mode 100644 index 0000000..f15262d --- /dev/null +++ b/src/shared/infra/email/services/email-service.test.ts @@ -0,0 +1,32 @@ +import { mock } from 'vitest-mock-extended'; + +import type { EmailAdapter } from '@/shared/infra/email/adapters/email-adapter'; +import { EmailService } from '@/shared/infra/email/services/email-service'; + +describe('[Service] Email', () => { + let emailAdapter: EmailAdapter; + let emailService: EmailService; + + beforeEach(() => { + emailAdapter = mock({ + sendEmail: vi.fn(), + }); + emailService = new EmailService(emailAdapter); + }); + + describe('List', () => { + it('Should call the sendEmail method', async () => { + const data = { + parameters: { name: 'John Doe' }, + recipient: 'johndoe@example.com', + subject: 'Test Subject', + template: 'test-template', + }; + + await emailService.sendEmail(data); + + expect(emailAdapter.sendEmail).toBeCalledWith(data); + expect(emailAdapter.sendEmail).toHaveBeenCalledTimes(1); + }); + }); +});