Skip to content

Commit

Permalink
Test for goldibex#108
Browse files Browse the repository at this point in the history
  • Loading branch information
dinoboff committed Dec 23, 2016
1 parent 52a6e97 commit 491311d
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/spec/lib/database/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -895,6 +895,30 @@ describe('database', function() {
expect(db.write('/a', 2).allowed).to.be.false();
});

it.only('should fix #108', function() {
const rules = {
rules: {
$key: {
'.write': 'newData.hasChild("bar")'
}
}
};
const data = {
foo: {
bar: true,
baz: true
}
};
const db = database.create(rules, data).with({debug: true});
const result = db.write('/foo/baz', null);

console.log('writing null to /foo/baz');
console.log('old root:', result.root.val());
console.log('new root:', result.newRoot.val());

expect(result.allowed, result.info).to.be.true();
});

});

describe('#update', function() {
Expand Down

0 comments on commit 491311d

Please sign in to comment.