diff --git a/gun.js b/gun.js index e648a177..87afb441 100644 --- a/gun.js +++ b/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]; diff --git a/test/common.js b/test/common.js index 9caec2b1..942558ce 100644 --- a/test/common.js +++ b/test/common.js @@ -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'); + }); }); }); \ No newline at end of file