-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Params not created from refPath #10
Comments
I just ran into this and its a total headscratcher. Makes my assertions a lot more complex and brittle and it seems like it would be default behavior for context to work with the path we provide. |
Found a way to make it feel normal for now, although not ideal.
|
Please fix :( |
Hey folks, I agree this is definitely confusing and it's high on my list of fixes. In the meantime, you can automatically construct your path from a string of wildcards like this... const pathTemplate = "/a/{wild}"
const params = {
wild: "value"
};
const pathSnapshot = Object.keys(params).reduce((s, k) => {
return s.replace(`{${k}}`, options.params[k]);
}, pathTemplate);
const snap = fft.database.makeDataSnapshot(val, pathSnapshot); |
Sweet, thanks! Keep up the good work! |
Where do options come from in options.params? Also is it a realtime db only solution? None of it works for me when trying to test functions+Firestore. |
Any updates on this ? I still run into the issue today. Happy to help if needed :) |
Any updates on this ? |
Version info
firebase-functions-test: v0.1.1
firebase-functions: v1.0.1
firebase-admin: v5.12.0
Steps to reproduce
Expected behavior
Actual behavior
Workaround
It took a few debugging attempts to discover that the pathRef wasn't auto parsing into the context's params without the options in wrap().
Re-reading the docs, it looks like this is by design and similar to what
firebase functions:shell
was doingHowever, If it's possible to automatically parse the refPath into context, please take this as a feature request 🙇.
Perhaps the docs could highlight that parsing params into context isn't a thing? 🤔
The text was updated successfully, but these errors were encountered: