Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Episode 147 - Testing Firestore Rules with the Emulator

Learn how to test your Firebase security rules using the new Cloud Firestore emulator.


### changelog
Fixing permission errors when adding mock data to firestore
as seen in https://github.com/AngularFirebase/147-firestore-emulator-rules-testing/issues/1
3 changes: 2 additions & 1 deletion spec/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ module.exports.setup = async (auth, data) => {
});

const db = app.firestore();
const dbAdmin = firebase.initializeAdminApp({projectId}).firestore();

// Write mock documents before rules
if (data) {
for (const key in data) {
const ref = db.doc(key);
const ref = dbAdmin.doc(key);
await ref.set(data[key]);
}
}
Expand Down