{"_id":"@codepunter-labs/mock-brevo","_rev":"2-93228b5b2d4dc6fc0387a6529ab1f1df","name":"@codepunter-labs/mock-brevo","dist-tags":{"latest":"0.2.0"},"versions":{"0.1.0":{"name":"@codepunter-labs/mock-brevo","version":"0.1.0","keywords":["mock","brevo","sendinblue","email","testing","transactional-email"],"author":{"name":"CodePunter Labs"},"license":"MIT","_id":"@codepunter-labs/mock-brevo@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":"a67d2985649d7f4f88000d7b67893b3139d13cb2","tarball":"https://registry.npmjs.org/@codepunter-labs/mock-brevo/-/mock-brevo-0.1.0.tgz","fileCount":7,"integrity":"sha512-K8gydi7BjP0sObx2v0PDfOrYPJAGWB61cLEb4RHu9nvLO0RzT7g4AjfMF3+kSRoBOdKil3xPJUF2cAmogG9VHg==","signatures":[{"sig":"MEYCIQDV6PZhsVZLVa4KSZ8R0q2dFme2JBnozu0xy4MTc208cwIhAPT0o7wD8F9nrM6TkYw3Of/woOSBX7SU0gmSGzUwGLMu","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":26880},"main":"./dist/index.cjs","type":"module","_from":"file:codepunter-labs-mock-brevo-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/0ab20ed3a3d46926db8ecae00a5cb206/codepunter-labs-mock-brevo-0.1.0.tgz","_integrity":"sha512-K8gydi7BjP0sObx2v0PDfOrYPJAGWB61cLEb4RHu9nvLO0RzT7g4AjfMF3+kSRoBOdKil3xPJUF2cAmogG9VHg==","repository":{"url":"git+https://github.com/DERRICK-TORKORNOO/mock-sdks.git","type":"git","directory":"packages/mock-brevo"},"_npmVersion":"10.8.2","description":"Mock SDK for Brevo API","directories":{},"_nodeVersion":"20.20.2","dependencies":{"@codepunter-labs/mock-core":"0.1.0"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","typescript":"^5.9.3","@codepunter-labs/mock-core":"0.1.0"},"_npmOperationalInternal":{"tmp":"tmp/mock-brevo_0.1.0_1783371655893_0.22658570678182666","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@codepunter-labs/mock-brevo","version":"0.2.0","description":"Mock SDK for Brevo API","repository":{"type":"git","url":"git+https://github.com/DERRICK-TORKORNOO/mock-sdks.git","directory":"packages/mock-brevo"},"type":"module","main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"keywords":["mock","brevo","sendinblue","email","testing","transactional-email"],"author":{"name":"CodePunter Labs"},"license":"MIT","devDependencies":{"tsup":"^8.5.1","typescript":"^5.9.3","@codepunter-labs/mock-core":"0.2.0"},"dependencies":{"@codepunter-labs/mock-core":"0.2.0"},"scripts":{"build":"tsup","dev":"tsup --watch","typecheck":"tsc --noEmit"},"_id":"@codepunter-labs/mock-brevo@0.2.0","bugs":{"url":"https://github.com/DERRICK-TORKORNOO/mock-sdks/issues"},"homepage":"https://github.com/DERRICK-TORKORNOO/mock-sdks#readme","_integrity":"sha512-laiIQmqMPxbk64kmbVEKCJNl5kpIcPmt0F+uzjkNXoNkRYYrweTgrpvxal3CXEXY4OZ9irc+iwDMuNKhzU2nLQ==","_resolved":"/tmp/03c7cf6a33725ce42d1dd38ef31ef3c3/codepunter-labs-mock-brevo-0.2.0.tgz","_from":"file:codepunter-labs-mock-brevo-0.2.0.tgz","_nodeVersion":"20.20.2","_npmVersion":"10.8.2","dist":{"integrity":"sha512-laiIQmqMPxbk64kmbVEKCJNl5kpIcPmt0F+uzjkNXoNkRYYrweTgrpvxal3CXEXY4OZ9irc+iwDMuNKhzU2nLQ==","shasum":"aac685d1a1537b7a9e80a571f51993861cfacd4f","tarball":"https://registry.npmjs.org/@codepunter-labs/mock-brevo/-/mock-brevo-0.2.0.tgz","fileCount":7,"unpackedSize":27493,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIHYQMzyB/D3VdJRm2UrSSf0HYST25mnMP1eBP1UCeTGxAiEA7PVxiOHOKbOSsprg+j7/NkRuRzKCJ7peQ3Cx3A9N7Qw="}]},"_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-brevo_0.2.0_1783446217281_0.34006984192722656"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-06T21:00:55.738Z","modified":"2026-07-07T17:43:37.546Z","0.1.0":"2026-07-06T21:00:56.021Z","0.2.0":"2026-07-07T17:43:37.427Z"},"bugs":{"url":"https://github.com/DERRICK-TORKORNOO/mock-sdks/issues"},"author":{"name":"CodePunter Labs"},"license":"MIT","homepage":"https://github.com/DERRICK-TORKORNOO/mock-sdks#readme","keywords":["mock","brevo","sendinblue","email","testing","transactional-email"],"repository":{"type":"git","url":"git+https://github.com/DERRICK-TORKORNOO/mock-sdks.git","directory":"packages/mock-brevo"},"description":"Mock SDK for Brevo API","maintainers":[{"name":"codepunter","email":"derrickmensahtorkornoo@gmail.com"}],"readme":"# @codepunter-labs/mock-brevo\n\nMock SDK for Brevo API (formerly Sendinblue). Provides fully-typed mock implementations for testing transactional email sending, templates, contacts, and webhooks without making real API calls.\n\n[![npm version](https://badge.fury.io/js/@codepunter-labs/mock-brevo.svg)](https://www.npmjs.com/package/@codepunter-labs/mock-brevo)\n[![GitHub](https://img.shields.io/badge/GitHub-Repository-blue)](https://github.com/DERRICK-TORKORNOO/mock-sdks/tree/main/packages/mock-brevo)\n\n## Installation\n\n```bash\nnpm install @codepunter-labs/mock-brevo\n```\n\n## Features\n\n- **Email Sending**: Send transactional emails with HTML, text, or templates\n- **Templates**: Create, update, list, and delete email templates\n- **Contacts**: Manage contacts with attributes and lists\n- **Webhooks**: Create and manage webhooks for email 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-brevo\n- **Source Code**: [src/](https://github.com/DERRICK-TORKORNOO/mock-sdks/tree/main/packages/mock-brevo/src)\n- **Tests**: [tests/](https://github.com/DERRICK-TORKORNOO/mock-sdks/tree/main/packages/mock-brevo/tests)\n\n## Usage\n\n### Basic Setup\n\n```typescript\nimport { vi } from 'vitest';\nimport { createMockBrevo } from '@codepunter-labs/mock-brevo';\n\nconst brevo = createMockBrevo({ spy: vi.fn });\n```\n\n### Using with Jest\n\n```typescript\nimport { createMockBrevo } from '@codepunter-labs/mock-brevo';\n\nconst brevo = createMockBrevo({ spy: jest.fn });\n```\n\n### Example: Send Email\n\n```typescript\n// Default behavior - returns realistic mock data\nconst result = await brevo.sendEmail({\n  sender: { email: 'sender@example.com', name: 'Sender' },\n  to: [{ email: 'recipient@example.com', name: 'Recipient' }],\n  subject: 'Test Email',\n  htmlContent: '<p>Hello World</p>'\n});\n```\n\n### Example: Send Email with Template\n\n```typescript\nconst result = await brevo.sendEmail({\n  sender: { email: 'sender@example.com' },\n  to: [{ email: 'recipient@example.com' }],\n  templateId: 1,\n  params: { name: 'John', order: 12345 }\n});\n```\n\n### Example: Create Template\n\n```typescript\nconst result = await brevo.createTemplate({\n  name: 'Welcome Email',\n  subject: 'Welcome',\n  htmlContent: '<h1>Welcome {{name}}</h1>'\n});\n```\n\n### Example: Create Contact\n\n```typescript\nconst result = await brevo.createContact({\n  email: 'john@example.com',\n  attributes: { FIRSTNAME: 'John', LASTNAME: 'Doe' },\n  listIds: [1]\n});\n```\n\n### Example: Override Mock Response\n\n```typescript\nimport { makeSendEmailResponse } from '@codepunter-labs/mock-brevo';\n\nbrevo.sendEmail.mockResolvedValue({\n  code: 200,\n  message: 'success',\n  data: makeSendEmailResponse({ messageId: '<custom@relay.domain.com>' })\n});\n```\n\n### Example: Error Simulation\n\n```typescript\nimport { MockErrors } from '@codepunter-labs/mock-core';\n\nbrevo.sendEmail.mockRejectedValue(\n  MockErrors.badRequest('Invalid email address')\n);\n```\n\n## API Reference\n\n### MockBrevo\n\n- `sendEmail(request)` - Send transactional email\n- `createTemplate(request)` - Create email template\n- `updateTemplate(request)` - Update email template\n- `getTemplate(templateId)` - Get template details\n- `listTemplates()` - List all templates\n- `deleteTemplate(templateId)` - Delete template\n- `createContact(request)` - Create contact\n- `updateContact(request)` - Update contact\n- `getContact(email)` - Get contact details\n- `listContacts()` - List all contacts\n- `deleteContact(email)` - Delete contact\n- `createWebhook(request)` - Create webhook\n- `updateWebhook(request)` - Update webhook\n- `getWebhook(id)` - Get webhook details\n- `listWebhooks()` - List all webhooks\n- `deleteWebhook(id)` - Delete webhook\n\n### Fixture Factories\n\n- `makeEmailAddress(email, name?)` - Create email address\n- `makeSendEmailResponse(options?)` - Create send email response\n- `makeTemplate(options?)` - Create template\n- `makeContact(options?)` - Create contact\n- `makeWebhook(options?)` - Create webhook\n\n## Testing Patterns\n\n### Test Success Path\n\n```typescript\ntest('should send email successfully', async () => {\n  const brevo = createMockBrevo({ spy: vi.fn });\n  \n  const result = await brevo.sendEmail(request);\n  \n  expect(result.code).toBe(200);\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 brevo = createMockBrevo({ spy: vi.fn });\n  \n  brevo.sendEmail.mockRejectedValue(\n    BrevoErrors.invalidEmail()\n  );\n  \n  await expect(brevo.sendEmail(request)).rejects.toMatchObject({ message: /Invalid email/ });\n});\n```\n\n### Test with Custom Data\n\n```typescript\ntest('should use custom message ID', async () => {\n  const brevo = createMockBrevo({ spy: vi.fn });\n  \n  brevo.sendEmail.mockResolvedValue({\n    code: 200,\n    message: 'success',\n    data: makeSendEmailResponse({ messageId: '<custom@relay.domain.com>' })\n  });\n  \n  const result = await brevo.sendEmail(request);\n  expect(result.data.messageId).toBe('<custom@relay.domain.com>');\n});\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md"}