Skip to content

Commit 9c2d7af

Browse files
authored
ci: run tests against Firebase emulator (#293)
- use versions 20 and 22 of NodeJS - use the latest versions of GH Actions - run the automated tests against the emulator instead of an actual Firebase project - use placeholders for the Firebase configuration in the examples
1 parent fb22381 commit 9c2d7af

File tree

7 files changed

+27
-22
lines changed

7 files changed

+27
-22
lines changed

.github/workflows/test.yaml

+8-4
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ jobs:
1313
strategy:
1414
matrix:
1515
node-version:
16-
- 14.x
16+
- 20.x
17+
- 22.x
1718
steps:
18-
- uses: actions/checkout@v1
19-
- uses: actions/setup-node@v1
19+
- uses: actions/checkout@v4
20+
- uses: actions/setup-node@v4
2021
with:
2122
node-version: ${{ matrix.node-version }}
2223

@@ -29,7 +30,10 @@ jobs:
2930
- run: npm install
3031
- run: npm run bootstrap
3132
- run: npm run lint
32-
- run: npm run test
33+
- name: Run tests against emulator
34+
run: |
35+
npm install -g firebase-tools
36+
firebase emulators:exec --only database --project fake-project-id 'npm run test'
3337
- run: npm run coverage
3438

3539
- name: Coveralls

examples/fish1/js/fish1.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
(function() {
22
// Initialize the Firebase SDK
3+
// TODO(DEVELOPER): Change the values below using values from the initialization snippet: Firebase Console > Overview > Add Firebase to your web app.
34
initializeApp({
4-
apiKey: "AIzaSyCR4ND2xwX3kU1IxTn0youF5OlI3x6MFZs",
5-
databaseURL: "https://geofire-gh-tests.firebaseio.com",
6-
projectId: "geofire-gh-tests"
5+
apiKey: "<YOUR_API_KEY>",
6+
databaseURL: "<YOUR_DB_URL>",
7+
projectId: "<YOUR_PROJECT_ID>"
78
});
89

910
// Generate a random Firebase location

examples/fish2/js/fish2.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
(function() {
22
// Initialize the Firebase SDK
33
initializeApp({
4-
apiKey: "sAIzaSyCR4ND2xwX3kU1IxTn0youF5OlI3x6MFZs",
5-
databaseURL: "https://geofire-gh-tests.firebaseio.com",
6-
projectId: "geofire-gh-tests"
4+
apiKey: "s<YOUR_API_KEY>",
5+
databaseURL: "<YOUR_DB_URL>",
6+
projectId: "<YOUR_PROJECT_ID>"
77
});
88

99
// Generate a random Firebase location

examples/fish3/js/fish3.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
(function() {
22
// Initialize the Firebase SDK
33
initializeApp({
4-
apiKey: "AIzaSyCR4ND2xwX3kU1IxTn0youF5OlI3x6MFZs",
5-
databaseURL: "https://geofire-gh-tests.firebaseio.com",
6-
projectId: "geofire-gh-tests"
4+
apiKey: "<YOUR_API_KEY>",
5+
databaseURL: "<YOUR_DB_URL>",
6+
projectId: "<YOUR_PROJECT_ID>"
77
});
88

99
// Generate a random Firebase location

examples/html5Geolocation/js/html5Geolocation.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
(function() {
22
// Initialize the Firebase SDK
33
initializeApp({
4-
apiKey: "AIzaSyCR4ND2xwX3kU1IxTn0youF5OlI3x6MFZs",
5-
databaseURL: "https://geofire-gh-tests.firebaseio.com",
6-
projectId: "geofire-gh-tests"
4+
apiKey: "<YOUR_API_KEY>",
5+
databaseURL: "<YOUR_DB_URL>",
6+
projectId: "<YOUR_PROJECT_ID>"
77
});
88

99
// Generate a random Firebase location

examples/queryBuilder/js/queryBuilder.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
(function() {
22
// Initialize the Firebase SDK
33
initializeApp({
4-
apiKey: "AIzaSyCR4ND2xwX3kU1IxTn0youF5OlI3x6MFZs",
5-
databaseURL: "https://geofire-gh-tests.firebaseio.com",
6-
projectId: "geofire-gh-tests"
4+
apiKey: "<YOUR_API_KEY>",
5+
databaseURL: "<YOUR_DB_URL>",
6+
projectId: "<YOUR_PROJECT_ID>"
77
});
88

99
// Generate a random Firebase location

packages/geofire/test/common.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ export let geoFireRef: DatabaseReference,
2929

3030
// Initialize Firebase
3131
const config = {
32-
apiKey: 'AIzaSyCR4ND2xwX3kU1IxTn0youF5OlI3x6MFZs',
33-
databaseURL: 'https://geofire-gh-tests.firebaseio.com',
34-
projectId: 'geofire-gh-tests'
32+
apiKey: '<YOUR_API_KEY>',
33+
databaseURL: 'https://fake-project-id.firebaseio.com',
34+
projectId: 'fake-project-id'
3535
};
3636
initializeApp(config);
3737

0 commit comments

Comments
 (0)