Skip to content

Commit 42b9086

Browse files
committed
Failing test case for accesing children in data snapshot by numbered array index
1 parent cf60ffe commit 42b9086

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/unit/snapshot.js

+12
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,18 @@ describe('DataSnapshot', function () {
119119
expect(child.getPriority()).to.equal(10);
120120
});
121121

122+
it('allows array indexes', function () {
123+
var parent = new Snapshot(ref, ['foo', 'bar']);
124+
var child = parent.child(0);
125+
expect(child.val()).to.equal('foo');
126+
});
127+
128+
it('allows array indexes in multiple paths', function () {
129+
var parent = new Snapshot(ref, { key: { array: ['foo', 'bar'] }});
130+
var child = parent.child('key/array/1');
131+
expect(child.val()).to.equal('bar');
132+
});
133+
122134
});
123135

124136
describe('#exists', function () {

0 commit comments

Comments
 (0)