Skip to content

Commit b49737f

Browse files
committed
[fixed] null value errors on lists
its like I haven't even used this yet ...
1 parent a6cf692 commit b49737f

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

src.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ var list = {
2929
},
3030

3131
transform (snapshotVal) {
32-
return toArray$(snapshotVal);
32+
return snapshotVal === null ? null : toArray$(snapshotVal);
3333
},
3434

3535
toString () {

tests.js

+29
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,35 @@ describe('ref', () => {
4343
});
4444
});
4545

46+
describe('getValue', () => {
47+
it('handles null values', (done) => {
48+
var schema = Schema.create(Firebase, HOST, (child) => {
49+
child('test', string);
50+
});
51+
var ref = schema.createRef('test');
52+
ref.getValue((err, val) => {
53+
expect(val).toEqual(null);
54+
done();
55+
});
56+
});
57+
58+
it.only('handles null values for lists', (done) => {
59+
var schema = Schema.create(Firebase, HOST, (child) => {
60+
child('test', list, (child) => {
61+
child(':id', string, (child) => {
62+
child('blergh', string);
63+
});
64+
});
65+
});
66+
var ref = schema.createRef('test');
67+
ref.getValue((err, val) => {
68+
expect(val).toEqual(null);
69+
done();
70+
});
71+
});
72+
73+
});
74+
4675
describe('listen', () => {
4776
it('listens', (done) => {
4877
var schema = Schema.create(Firebase, HOST, (child) => {

0 commit comments

Comments
 (0)