{"_id":"@codepunter-labs/mock-mail","_rev":"2-b4050c11dde94d41ae8001a7eb8d7d9e","name":"@codepunter-labs/mock-mail","dist-tags":{"latest":"0.2.0"},"versions":{"0.1.0":{"name":"@codepunter-labs/mock-mail","version":"0.1.0","license":"MIT","_id":"@codepunter-labs/mock-mail@0.1.0","maintainers":[{"name":"codepunter","email":"derrickmensahtorkornoo@gmail.com"}],"homepage":"https://github.com/DERRICK-TORKORNOO/mock-sdks#readme","bugs":{"url":"https://github.com/DERRICK-TORKORNOO/mock-sdks/issues"},"dist":{"shasum":"49feb5b657f0e623bef29d78802e42d575b84170","tarball":"https://registry.npmjs.org/@codepunter-labs/mock-mail/-/mock-mail-0.1.0.tgz","fileCount":9,"integrity":"sha512-jW+Ey4Cu1VTgQSaHODlm6MGEJzuI2kHDqrBM49MOgFHYTxqvpiy05vey3i6AKx30grhpvlTBxdKDBLlcekJlIQ==","signatures":[{"sig":"MEUCIHqNH23A0e4yao05xVVGNvnkAo1nk+Fn2/iEc7RU2qVpAiEAvEH6nBuHsoDzABQ4FKEAONZlLeqwi2pfdNVQ3Mmi3dE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":54753},"main":"./dist/index.cjs","type":"module","_from":"file:codepunter-labs-mock-mail-0.1.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"scripts":{"dev":"tsup --watch","build":"tsup","typecheck":"tsc --noEmit"},"_npmUser":{"name":"codepunter","email":"derrickmensahtorkornoo@gmail.com"},"_resolved":"/tmp/b2c574fdf231b1fb1460d0dca2a6c318/codepunter-labs-mock-mail-0.1.0.tgz","_integrity":"sha512-jW+Ey4Cu1VTgQSaHODlm6MGEJzuI2kHDqrBM49MOgFHYTxqvpiy05vey3i6AKx30grhpvlTBxdKDBLlcekJlIQ==","repository":{"url":"git+https://github.com/DERRICK-TORKORNOO/mock-sdks.git","type":"git","directory":"packages/mock-mail"},"_npmVersion":"10.8.2","description":"TODO","directories":{},"_nodeVersion":"20.20.2","dependencies":{"@codepunter-labs/mock-core":"0.1.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"*","vitest":"*","typescript":"*"},"_npmOperationalInternal":{"tmp":"tmp/mock-mail_0.1.0_1783371655667_0.5218552919040678","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@codepunter-labs/mock-mail","version":"0.2.0","description":"TODO","repository":{"type":"git","url":"git+https://github.com/DERRICK-TORKORNOO/mock-sdks.git","directory":"packages/mock-mail"},"license":"MIT","type":"module","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","dependencies":{"@codepunter-labs/mock-core":"0.2.0"},"devDependencies":{"tsup":"*","typescript":"*","vitest":"*"},"scripts":{"build":"tsup","dev":"tsup --watch","typecheck":"tsc --noEmit"},"_id":"@codepunter-labs/mock-mail@0.2.0","bugs":{"url":"https://github.com/DERRICK-TORKORNOO/mock-sdks/issues"},"homepage":"https://github.com/DERRICK-TORKORNOO/mock-sdks#readme","_integrity":"sha512-ly5EmyF6N6Mk3SJ76U7cJYL03lUJx5+t1KRzA5MaYaMrYBCugFamQnMRf9IotvqwP6LEbzRya4Ymjym4WF5bzw==","_resolved":"/tmp/1bc7f41a1b0d6f4655b8d18f8d45049b/codepunter-labs-mock-mail-0.2.0.tgz","_from":"file:codepunter-labs-mock-mail-0.2.0.tgz","_nodeVersion":"20.20.2","_npmVersion":"10.8.2","dist":{"integrity":"sha512-ly5EmyF6N6Mk3SJ76U7cJYL03lUJx5+t1KRzA5MaYaMrYBCugFamQnMRf9IotvqwP6LEbzRya4Ymjym4WF5bzw==","shasum":"a485f5f83db5269b2ddef9e37e510905b8d2cea9","tarball":"https://registry.npmjs.org/@codepunter-labs/mock-mail/-/mock-mail-0.2.0.tgz","fileCount":9,"unpackedSize":57648,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIF8E1UcEGCb2ZnT/6nRmV6HScDyX1xjQTCqzbJyLGZ4FAiBerIcCLJKMV5+Gaf/nNbRsaERKG3///7Sp0NoDnqPxiw=="}]},"_npmUser":{"name":"codepunter","email":"derrickmensahtorkornoo@gmail.com"},"directories":{},"maintainers":[{"name":"codepunter","email":"derrickmensahtorkornoo@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/mock-mail_0.2.0_1783446218353_0.7259323506932243"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-06T21:00:55.516Z","modified":"2026-07-07T17:43:38.651Z","0.1.0":"2026-07-06T21:00:55.798Z","0.2.0":"2026-07-07T17:43:38.513Z"},"bugs":{"url":"https://github.com/DERRICK-TORKORNOO/mock-sdks/issues"},"license":"MIT","homepage":"https://github.com/DERRICK-TORKORNOO/mock-sdks#readme","repository":{"type":"git","url":"git+https://github.com/DERRICK-TORKORNOO/mock-sdks.git","directory":"packages/mock-mail"},"description":"TODO","maintainers":[{"name":"codepunter","email":"derrickmensahtorkornoo@gmail.com"}],"readme":"# @codepunter-labs/mock-mail\n\nMock SDK for email APIs. Provides fully-typed mock implementations for testing email sending, templates, status tracking, and webhooks without making real API calls.\n\n[![npm version](https://badge.fury.io/js/@codepunter-labs/mock-mail.svg)](https://www.npmjs.com/package/@codepunter-labs/mock-mail)\n[![GitHub](https://img.shields.io/badge/GitHub-Repository-blue)](https://github.com/DERRICK-TORKORNOO/mock-sdks/tree/main/packages/mock-mail)\n\n## Installation\n\n```bash\nnpm install @codepunter-labs/mock-mail\n```\n\n## Features\n\n- **Send Email**: Send direct emails and template-based emails\n- **Email Status**: Track email delivery status\n- **Templates**: Create and manage email templates\n- **Webhooks**: Verify webhook signatures and parse events\n- **Type-safe**: Full TypeScript support with accurate API types\n- **Test Framework Agnostic**: Works with Jest, Vitest, and other spy-based frameworks\n\n## Repository\n\n- **GitHub**: https://github.com/DERRICK-TORKORNOO/mock-sdks/tree/main/packages/mock-mail\n- **Source Code**: [src/](https://github.com/DERRICK-TORKORNOO/mock-sdks/tree/main/packages/mock-mail/src)\n- **Tests**: [tests/](https://github.com/DERRICK-TORKORNOO/mock-sdks/tree/main/packages/mock-mail/tests)\n\n## Usage\n\n### Basic Setup\n\n```typescript\nimport { vi } from 'vitest';\nimport { createMockMail } from '@codepunter-labs/mock-mail';\n\nconst mail = createMockMail({ spy: vi.fn });\n```\n\n### Using with Jest\n\n```typescript\nimport { createMockMail } from '@codepunter-labs/mock-mail';\n\nconst mail = createMockMail({ spy: jest.fn });\n```\n\n### Example: Send Email\n\n```typescript\n// Default behavior - returns realistic mock data\nconst result = await mail.sendEmail({\n  to: 'recipient@example.com',\n  from: 'sender@example.com',\n  subject: 'Test Email',\n  html: '<p>Hello World</p>'\n});\n```\n\n### Example: Send Template Email\n\n```typescript\nconst result = await mail.sendTemplateEmail({\n  templateId: 'tpl_123',\n  to: 'recipient@example.com',\n  variables: { name: 'John' }\n});\n```\n\n### Example: Get Email Status\n\n```typescript\nconst result = await mail.getEmailStatus('msg_123');\n```\n\n### Example: Override Mock Response\n\n```typescript\nimport { makeSendEmailResponse } from '@codepunter-labs/mock-mail';\n\nmail.sendEmail.mockResolvedValue({\n  success: true,\n  message: 'Email sent successfully',\n  data: makeSendEmailResponse({ status: 'sent' })\n});\n```\n\n### Example: Error Simulation\n\n```typescript\nimport { MailErrors } from '@codepunter-labs/mock-mail';\n\nmail.sendEmail.mockRejectedValue(\n  MailErrors.invalidEmail()\n);\n```\n\n### Example: Webhook Verification\n\n```typescript\nconst isValid = mail.verifyWebhookSignature(\n  payload,\n  signature,\n  'webhook-secret'\n);\n\nconst event = mail.parseWebhookEvent(payload);\n```\n\n## API Reference\n\n### MockMail\n\n| Method | Description | Source |\n|--------|-------------|--------|\n| `sendEmail(request)` | Send email | [mock-mail.ts](https://github.com/DERRICK-TORKORNOO/mock-sdks/blob/main/packages/mock-mail/src/mock-mail.ts) |\n| `sendTemplateEmail(request)` | Send template email | [mock-mail.ts](https://github.com/DERRICK-TORKORNOO/mock-sdks/blob/main/packages/mock-mail/src/mock-mail.ts) |\n| `getEmailStatus(messageId)` | Get email status | [mock-mail.ts](https://github.com/DERRICK-TORKORNOO/mock-sdks/blob/main/packages/mock-mail/src/mock-mail.ts) |\n| `listEmailStatuses(options?)` | List email statuses | [mock-mail.ts](https://github.com/DERRICK-TORKORNOO/mock-sdks/blob/main/packages/mock-mail/src/mock-mail.ts) |\n| `createTemplate(request)` | Create email template | [mock-mail.ts](https://github.com/DERRICK-TORKORNOO/mock-sdks/blob/main/packages/mock-mail/src/mock-mail.ts) |\n| `getTemplate(templateId)` | Get template details | [mock-mail.ts](https://github.com/DERRICK-TORKORNOO/mock-sdks/blob/main/packages/mock-mail/src/mock-mail.ts) |\n| `listTemplates()` | List all templates | [mock-mail.ts](https://github.com/DERRICK-TORKORNOO/mock-sdks/blob/main/packages/mock-mail/src/mock-mail.ts) |\n| `verifyWebhookSignature(payload, signature, secret)` | Verify webhook signature | [mock-mail.ts](https://github.com/DERRICK-TORKORNOO/mock-sdks/blob/main/packages/mock-mail/src/mock-mail.ts) |\n| `parseWebhookEvent(payload)` | Parse webhook event | [mock-mail.ts](https://github.com/DERRICK-TORKORNOO/mock-sdks/blob/main/packages/mock-mail/src/mock-mail.ts) |\n\n### Fixture Factories\n\n| Factory | Description | Source |\n|---------|-------------|--------|\n| `makeSendEmailResponse(options?)` | Create send email response | [fixtures.ts](https://github.com/DERRICK-TORKORNOO/mock-sdks/blob/main/packages/mock-mail/src/fixtures.ts) |\n| `makeEmailStatus(options?)` | Create email status | [fixtures.ts](https://github.com/DERRICK-TORKORNOO/mock-sdks/blob/main/packages/mock-mail/src/fixtures.ts) |\n| `makeEmailTemplate(options?)` | Create email template | [fixtures.ts](https://github.com/DERRICK-TORKORNOO/mock-sdks/blob/main/packages/mock-mail/src/fixtures.ts) |\n| `makeWebhookEvent(options?)` | Create webhook event | [fixtures.ts](https://github.com/DERRICK-TORKORNOO/mock-sdks/blob/main/packages/mock-mail/src/fixtures.ts) |\n\n### Error Factories\n\n| Error | Description | Source |\n|-------|-------------|--------|\n| `MailErrors.unauthorized()` | Unauthorized error | [errors.ts](https://github.com/DERRICK-TORKORNOO/mock-sdks/blob/main/packages/mock-mail/src/errors.ts) |\n| `MailErrors.invalidEmail()` | Invalid email error | [errors.ts](https://github.com/DERRICK-TORKORNOO/mock-sdks/blob/main/packages/mock-mail/src/errors.ts) |\n| `MailErrors.sendFailed()` | Send failed error | [errors.ts](https://github.com/DERRICK-TORKORNOO/mock-sdks/blob/main/packages/mock-mail/src/errors.ts) |\n| `MailErrors.serverError()` | Server error | [errors.ts](https://github.com/DERRICK-TORKORNOO/mock-sdks/blob/main/packages/mock-mail/src/errors.ts) |\n\n## Testing Patterns\n\n### Test Success Path\n\n```typescript\ntest('should send email successfully', async () => {\n  const mail = createMockMail({ spy: vi.fn });\n  \n  const result = await mail.sendEmail(request);\n  \n  expect(result.success).toBe(true);\n  expect(result.data.messageId).toBeDefined();\n});\n```\n\n### Test Error Handling\n\n```typescript\ntest('should handle invalid email address error', async () => {\n  const mail = createMockMail({ spy: vi.fn });\n  \n  mail.sendEmail.mockRejectedValue(\n    MailErrors.invalidEmail()\n  );\n  \n  await expect(mail.sendEmail(request)).rejects.toMatchObject({ message: /Invalid email/ });\n});\n```\n\n### Test with Custom Data\n\n```typescript\ntest('should use custom email status', async () => {\n  const mail = createMockMail({ spy: vi.fn });\n  \n  mail.sendEmail.mockResolvedValue({\n    success: true,\n    message: 'Email sent successfully',\n    data: makeSendEmailResponse({ status: 'delivered' })\n  });\n  \n  const result = await mail.sendEmail(request);\n  expect(result.data.status).toBe('delivered');\n});\n```\n\n### Test Webhook\n\n```typescript\ntest('should verify webhook signature', () => {\n  const mail = createMockMail({ spy: vi.fn });\n  \n  const isValid = mail.verifyWebhookSignature(\n    '{\"event\":\"delivered\"}',\n    'signature',\n    'secret'\n  );\n  \n  expect(isValid).toBe(true);\n});\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md"}