mirror of
https://github.com/amark/gun.git
synced 2025-03-30 15:08:33 +00:00
no false positive null emit FIXED with test
This commit is contained in:
parent
a01ca23304
commit
2195b0e9d0
3
gun.js
3
gun.js
@ -297,7 +297,8 @@
|
||||
if(err){ return cb.call(gun, err, data) }
|
||||
if(!data){
|
||||
if(ctx.soul){ return }
|
||||
return cb.call(gun, null, null), gun._.at('null').emit()
|
||||
cb.call(gun, null, null);
|
||||
return gun._.at('null').emit();
|
||||
}
|
||||
if(ctx.soul = Gun.is.soul.on(data)){
|
||||
gun._.at('soul').emit({soul: ctx.soul});
|
||||
|
@ -1321,5 +1321,25 @@ describe('Gun', function(){
|
||||
done();
|
||||
}, 'qwertyasdfzxcv');
|
||||
});
|
||||
|
||||
it('no false positive null emit', function(done){
|
||||
var gun = Gun({hooks: {get: function(key, cb){
|
||||
cb(null, {_: {'#': soul, '>': {'a': 0}},
|
||||
'a': 'b'
|
||||
});
|
||||
cb(null, {_: {'#': soul }});
|
||||
cb(); // false trigger!
|
||||
}}}), soul = Gun.text.random();
|
||||
|
||||
gun.get('me').not(function(){
|
||||
done.fail = true;
|
||||
}).val(function(val){
|
||||
setTimeout(function(){
|
||||
expect(val.a).to.be('b');
|
||||
expect(done.fail).to.not.be.ok();
|
||||
done();
|
||||
},5);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user