29 lines
731 B
TypeScript
29 lines
731 B
TypeScript
/**
|
|
* Mock push notification provider — for testing and local dev.
|
|
*
|
|
* Logs notifications instead of sending them.
|
|
*/
|
|
|
|
import type { PushNotification, PushProvider, PushResult } from '../types.js';
|
|
|
|
export class MockPushProvider implements PushProvider {
|
|
public sent: PushNotification[] = [];
|
|
|
|
isConfigured(): boolean {
|
|
return true;
|
|
}
|
|
|
|
async send(notification: PushNotification): Promise<PushResult> {
|
|
this.sent.push(notification);
|
|
return { success: true, messageId: `mock-${Date.now()}-${this.sent.length}` };
|
|
}
|
|
|
|
async sendBatch(notifications: PushNotification[]): Promise<PushResult[]> {
|
|
return Promise.all(notifications.map(n => this.send(n)));
|
|
}
|
|
|
|
reset(): void {
|
|
this.sent = [];
|
|
}
|
|
}
|