From what I understand about your question, what you are looking for comes down to a solution for translating the cloud functions that you deploy into the appropriate settings, that is, production, development and testing, which, I believe, means that everyone of these, a unique project and therefore a database in your Firebase environment.
If the above is true, then the following should help.
Cloud-based Firebase and CLI functions can more generally be deployed to a specific project in a Firebase environment. To do this, run the command in the terminal in the cloud functions directory.
$ firebase use -add
This will allow you to select your additional project (for example, development) and assign it an alias (I recommend "development" if it is such). Then, when deploying your functions, you can choose which project (and therefore the database) to deploy using an alias.
$ firebase use default
For more information see: https://firebase.googleblog.com/2016/07/deploy-to-multiple-environments-with.html
One thing you might have to do for this is to use the default configuration settings for the cloud features.
$ admin.initializeApp(functions.config().firebase);
source share