fix: Resolve daily-notification test suite issues

- Fix test structure to use DailyNotification class with mocks
- Add proper validation for required URL parameter
- Fix event handler error handling in setupEventListeners
- Update all tests to use mock plugin instead of Capacitor plugin
- Add comprehensive validation tests for URL, time, timezone, retry settings
- All 18 daily-notification tests now passing
This commit is contained in:
Matthew Raymer
2025-08-12 09:59:52 +00:00
parent 76295f62b3
commit e51f884e00
3 changed files with 154 additions and 37 deletions

View File

@@ -142,13 +142,20 @@ export class DailyNotification {
private setupEventListeners(): void {
document.addEventListener('notification', (event: Event) => {
this.eventListeners.get('notification')?.forEach(handler => {
handler(event);
try {
handler(event);
} catch (error) {
console.error('Error in event handler:', error);
}
});
});
}
private validateOptions(options: NotificationOptions): void {
if (options.url && !this.isValidUrl(options.url)) {
if (!options.url) {
throw new Error('URL is required');
}
if (!this.isValidUrl(options.url)) {
throw new Error('Invalid URL format');
}
if (options.time && !this.isValidTime(options.time)) {