MockFirebase ref.child and childRef are not equivalent

by Kyrylo Slatin

HTML

<script src="https://cdn.firebase.com/js/client/2.0.2/firebase.js"></script>
<script src="http://res.cloudinary.com/dh7gt9qcl/raw/upload/v1423137478/mockfirebase.js"></script>
See console for significant output

JavaScript

MockFirebase.override();
var fbRoot = 'https://example.firebaseio.com/test/';
var ref = new Firebase(fbRoot);
var childRef = new Firebase(fbRoot + '/child');
var counter = 0,
    childCounter = 0;
ref.child('child').on('child_added', function (snapshot) {
    counter++;
});
childRef.on('child_added', function (snapshot) {
    childCounter++;
});
ref.child('child').push({
    b: 'aa'
});
ref.child('child').flush();
console.assert(counter === 1, 'child.push worked');
console.assert(childCounter === 1, 'childRef.push worked');
childRef.push({
    b: 'aa'
});
childRef.flush();
console.assert(counter === 2, 'child.push worked twice');
console.assert(childCounter === 2, 'childRef.push worked twice');