Closed barmalejj closed 7 years ago
@barmalejj
Can you check https://github.com/dinoboff/targaryen/commit/267efe3c9f96db26c2fa75d9502ba1c56f33dc39; the test passes. How can I reproduce your error?
Here:
someAttrsCollection: {
+ 0: {
+ itemId: 'foo'
+ }
+ }
is a mistake. someAttrsCollection should be an array. Like:
someAttrsCollection: [
+ 0: {
+ itemId: 'foo'
+ }
+ ]
Update with data set to to an array... the tests are still passes.
@barmalejj
ps: I added an assertion to test the write operation fails if there's no itemId. https://github.com/dinoboff/targaryen/commit/8ed4e2a73380ee3076d969e40c2157c6957e4131
Feel free to reopen if some inconsistent test (as a bare minimum, db data, its rules, and simulation write path and data).
Hey!
Great library! I was looking for something like that, BUT ... it doesn't work well for array-like collections. Example: lets say we have collection like that: (We're are using bolt in our project)
This code after compile results with rules like
so, if we make write operation like that:
/item/someAttrsCollection/0/someAttrProp, 'some value'
it should be successful (and it is in real database!!!), but unit test with targaryen fails (write is denied) complaining to this rule".validate": "newData.hasChildren() && newData.hasChild('itemId')"