Mock Plugin
A testing utility plugin for SimpleNS development and integration testing.
What is Mock Plugin
The @simplens/mock plugin is a lightweight, zero-dependency provider designed specifically for testing and development within the SimpleNS ecosystem. It simulates notification delivery without actually sending anything.
How It Works
This plugin simulates notification delivery by logging to the console. When a notification is sent:
- The plugin receives the notification payload
- Validates the
recipient.user_idandcontent.messagefields - Logs the notification details to the console
- Returns
{ success: true }immediately
No API keys, SMTP servers, or third-party services required. Perfect for CI/CD pipelines and local development.
Installation
npm run plugin:install @simplens/mockSee the Plugin Installation Guide for installing plugins in your simplens-core
Configuration
Add the plugin to your simplens.config.yaml if you used Config-first method from Plugin Installation Guide:
providers:
- package: "@simplens/mock"
id: mock
credentials: {}
options:
priority: 1
rateLimit:
maxTokens: 100
refillRate: 10
channels:
mock:
default: "mock"Required Credentials
| Key | Description |
|---|---|
| (none) | No credentials required! |
No credentials required! The mock plugin works out of the box with zero configuration.
Rate Limit
| Key | Default | Description |
|---|---|---|
maxTokens | 100 | Max tokens in bucket |
refillRate | 10 | Tokens refilled per second |
Environment Variables
# No environment variables required for mock pluginNotification Payload
- You can easily get and configure this request payload from
Payload Studioin Admin Dashboard
{
"request_id": "uuid-v4",
"client_id": "uuid-v4",
"channel": "mock",
"recipient": {
"user_id": "user-123"
},
"content": {
"message": "Hello {{name}}, welcome to SimpleNS!"
},
"variables": {
"name": "John"
}
}Features
| Feature | Description |
|---|---|
| Zero Dependencies | No API keys or external services required |
| Instant Response | No network latency or rate limiting |
| Safe Testing | No real notifications sent |
| CI/CD Ready | Perfect for automated test suites |
| Always Healthy | healthCheck() always returns true |
| Template Variables | Supports {{key}} syntax |
Docs