0
0
Firebasecloud~10 mins

Testing rules with emulator in Firebase - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to start the Firebase emulator for Firestore.

Firebase
firebase emulators:start --only [1]
Drag options to blanks, or click blank then click option'
Afirestore
Bfunctions
Cauth
Ddatabase
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'functions' instead of 'firestore' to start the Firestore emulator.
Using 'auth' or 'database' which start other emulators.
2fill in blank
medium

Complete the code to run security rules tests using the Firebase emulator.

Firebase
firebase emulators:exec --only [1] "npm test"
Drag options to blanks, or click blank then click option'
Afunctions
Bfirestore
Cauth
Ddatabase
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'functions' which runs cloud functions emulator instead.
Using 'auth' or 'database' which are unrelated to Firestore rules testing.
3fill in blank
hard

Fix the error in the command to start the Firestore emulator with the correct port.

Firebase
firebase emulators:start --only firestore --[1] 8080
Drag options to blanks, or click blank then click option'
Aendpoint
Bhost
Caddress
Dport
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'host' or 'address' which specify network address, not port.
Using 'endpoint' which is not a valid flag.
4fill in blank
hard

Fill both blanks to configure the Firestore emulator host and port in the Firebase config.

Firebase
firebase.firestore().settings({ host: '[1]', ssl: false, port: [2] });
Drag options to blanks, or click blank then click option'
Alocalhost
B127.0.0.1
C8080
D5000
Attempts:
3 left
💡 Hint
Common Mistakes
Using IP address instead of 'localhost' for host.
Using wrong port number like 5000.
5fill in blank
hard

Fill all three blanks to initialize the Firebase app with emulator settings for Firestore.

Firebase
const app = initializeApp({ apiKey: '[1]', projectId: '[2]' }); const db = getFirestore(app); connectFirestoreEmulator(db, '[3]', 8080);
Drag options to blanks, or click blank then click option'
Afake-api-key
Bdemo-project
Clocalhost
Dreal-api-key
Attempts:
3 left
💡 Hint
Common Mistakes
Using real API keys or project IDs in emulator setup.
Using wrong host instead of 'localhost' for emulator connection.