Skip to content

Commit

Permalink
Add unit testing Cloud Functions sample (firebase#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
samtstern authored Jul 1, 2020
1 parent 8937cb2 commit d05d106
Show file tree
Hide file tree
Showing 17 changed files with 9,975 additions and 67 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ The repository is broken up by testing strategy:
* **[Unit testing security rules](unit-test-security-rules/README.md)** -
write unit tests for your Realtime Database and Cloud Firestore security
rules using `mocha` and the `@firebase/testing` library.
* **[Unit testing Cloud Functions](unit-test-cloud-functions/README.md)** -
write unit tests for your Cloud Functions usiing the `firebase-functions-test` SDK.
* **[Connect your app to the Emulator Suite](manual-emulator-testing/README.md)** -
connect the Firebase SDKs in your app directly to the local emulators and manually
test your app.
Expand Down
16 changes: 16 additions & 0 deletions firebase.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"emulators": {
"functions": {
"port": 5001
},
"firestore": {
"port": 8080
},
"database": {
"port": 9000
},
"ui": {
"enabled": false
}
}
}
5 changes: 3 additions & 2 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"packages": [
"unit-test-security-rules",
"manual-emulator-testing"
"manual-emulator-testing",
"unit-test-cloud-functions/functions",
"unit-test-security-rules"
],
"version": "0.0.0"
}
2 changes: 1 addition & 1 deletion manual-emulator-testing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ You will also need the [Firebase CLI](https://firebase.google.com/docs/cli).
First start the emulators:

```
firebase --project=manual-emulator-testing emulators:start
firebase --project=fakeproject emulators:start
```

Next visit `http://localhost:5000` in your browser and you should see a
Expand Down
2 changes: 1 addition & 1 deletion manual-emulator-testing/public/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// Initialze Firestore pointing at our test project
const db = firebase
.initializeApp({
projectId: "manual-emulator-testing",
projectId: "fakeproject",
})
.firestore();

Expand Down
Loading

0 comments on commit d05d106

Please sign in to comment.