-
Notifications
You must be signed in to change notification settings - Fork 36
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
Null values are passed up the hierarchy #113
Comments
Hi, which version are your using? ps: the rules only allow read and write of A/B/C. Anything else than a read of or write to A/B/C. (or patch of A/B with an object having only a C property) would fail:
|
Please reopen if you can provide more details. |
Sorry for the late reply. I used 2.3.3, but I just updated now. Just to clarify, because maybe I misunderstood the behavior of the patch rule. Can this be simulated with a rule using patch? |
Targaryen support multi-location updates. Assuming you have the following rules:
Firebase allows something like that:
But not:
At least that how I understand it and how targaryen@3 simulates it. https://firebase.google.com/docs/reference/js/firebase.database.Reference#update |
Actually this is supported by multi-location updates as far as I know and is also backed by the fact that our setup works in production: Then we do the following:
|
rule example with: ``` npm i -g targaryen@3 mocha chai mocha docs/chai/examples/issue-113.js ``` fix goldibex#113
Please read again what I wrote; Targaryen@3 support multilocation write operations using the The failing operations I pointed out are failing because they are targeting a level without write permissions. Please check dinoboff@be60fdf for an example. |
I will create an example project to test something I think is not working correctly. I will open a different issue if this is the case. |
Thanks. |
When writing or patching a
null
value, thenull
is passed up the hierarchy which causes tests to fail when they should not.Example:
Chai code:
expect().can.write({C: 1}).to.path('A/B');
- passesexpect().can.write({C: null}).to.path('A/B');
- fails:AssertionError: Expected an unauthenticated user to be able to write `null` to A/B, but the rules denied the write. No .write rule allowed the operation. Write was denied.
expect().can.patch({C: 1}).to.path('A/B');
- passesexpect().can.patch({C: null}).to.path('A/B');
- passesexpect().can.write({B: {C: 1}}).to.path('A');
- passesexpect().can.write({B: {C: null}}).to.path('A');
- fails:AssertionError: Expected an unauthenticated user to be able to write `null` to A, but the rules denied the write. No .write rule allowed the operation. Write was denied.
expect().can.patch({B: {C: 1}}).to.path('A');
- passesexpect().can.patch({B: {C: null}}).to.path('A');
- fails:AssertionError: Expected an unauthenticated user to be able to write `null` to A/B, but the rules denied the write. No .write rule allowed the operation. Write was denied.
The text was updated successfully, but these errors were encountered: