mirror of
https://github.com/amark/gun.git
synced 2025-03-30 15:08:33 +00:00
fixed opt/soul with TEST
This commit is contained in:
parent
d8d4cfd3f2
commit
a01ca23304
4
gun.js
4
gun.js
@ -326,13 +326,13 @@
|
||||
opt = Gun.text.is(opt)? {soul: opt} : opt || {};
|
||||
opt.soul = opt.soul || opt[Gun._.soul];
|
||||
gun._.at('soul').event(index);
|
||||
if(opt.soul){ // TODO! BUG! WRITE A TEST FOR THIS!
|
||||
if(opt.soul){ // force inject // TODO! BUG! WRITE A TEST FOR THIS!
|
||||
if(!gun.__.graph[opt.soul]){
|
||||
gun.__.graph[opt.soul] = {_: {'#': opt.soul, '>': {}}}; // TODO! SYMBOLS SHOULD NOT BE HARD CODED!
|
||||
}
|
||||
gun.__.keys[key] = gun.__.graph[opt.soul];
|
||||
gun._.at('soul').emit({soul: opt.soul});
|
||||
} else {
|
||||
} else { // will be injected via a put
|
||||
(gun.__.flag.start[key] = gun._.at('node')).once(function($){
|
||||
gun.__.keys[key] = gun.__.graph[$.soul];
|
||||
delete gun.__.flag.start[key];
|
||||
|
@ -1311,5 +1311,15 @@ describe('Gun', function(){
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
it('key soul', function(done){
|
||||
var gun = Gun();
|
||||
gun.key('me', function(err, ok){
|
||||
expect(err).to.not.be.ok();
|
||||
expect(gun.__.keys['me']).to.be.ok();
|
||||
expect(Gun.is.soul.on(gun.__.keys['me'])).to.be.ok();
|
||||
done();
|
||||
}, 'qwertyasdfzxcv');
|
||||
});
|
||||
});
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user