feat: Add Firebase security rules testing and error handling

Introduces unit tests for Firestore security rules and adds error handling to data fetching hooks. This enhances the robustness and security of the application by validating access control logic and providing feedback on data retrieval failures.

Includes:
- Setup for Firestore unit testing.
- Basic tests for signal query and user collection access.
- Error logging for `testimonials` and `notifications` data fetching.
- Updates to `firestore.rules` for stricter access checks.
- Adds necessary development dependencies for testing.
This commit is contained in:
desartstudio95
2026-05-06 15:07:22 +02:00
parent 03cbe2086a
commit 3fe6dd4671
6 changed files with 222 additions and 1 deletions
+2
View File
@@ -18,6 +18,8 @@ export const LandingPage: React.FC<LandingPageProps> = ({ onGetStarted, onViewPl
const q = query(collection(db, 'testimonials'), orderBy('timestamp', 'desc'));
const unsubscribe = onSnapshot(q, (snapshot) => {
setTestimonials(snapshot.docs.map(doc => ({ id: doc.id, ...doc.data() })));
}, (error) => {
console.error("Testimonials fetch error:", error);
});
return () => unsubscribe();
}, []);
+2
View File
@@ -39,6 +39,8 @@ export const NotificationManager: React.FC = () => {
}
}
});
}, (error) => {
console.error("Notifications fetch error:", error);
});
return () => unsubscribe();