Repro for Jest issue
'use strict'; | |
const firebase = require("firebase-admin"); | |
const serviceAccount = require('./serviceAccountKey.json'); | |
firebase.initializeApp({ | |
credential: firebase.credential.cert(serviceAccount), | |
databaseURL: `https://${serviceAccount.project_id}.firebaseio.com` | |
}); | |
exports.handler = async () => { | |
await firebase | |
.database() | |
.ref(`/someRef`) | |
.set({some:"data"}); | |
} |
const pushToFirebase = require("./main.js"); | |
test("can push message", async () => { | |
await pushToFirebase.handler(); | |
expect(true).toEqual(true); | |
// this will hang - need to call firebase.database().goOffline() to close all handles | |
}); |
{ | |
"name": "pushtofirebase", | |
"version": "1.0.0", | |
"main": "pushToFirebase.js", | |
"dependencies": { | |
"firebase-admin": "^8.10.0" | |
}, | |
"devDependencies": { | |
"jest": "^25.2.3" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment