fixed path, added some tests, need more

This commit is contained in:
Mark Nadal 2015-01-21 13:40:19 -07:00
parent 59b53c084f
commit 28861f4e67
3 changed files with 26 additions and 4 deletions

View File

@ -2,10 +2,9 @@
"name": "gun",
"main": "gun.js",
"version": "0.0.9",
"homepage": "http://gundb.io",
"homepage": "http://gunDB.io",
"authors": [
{ "name": "Mark Nadal", "email": "mark@accelsor.com" },
{ "name": "AJ ONeal", "email": "awesome@coolaj86.com" },
{ "name": "Alex LaFroscia", "email": "alex@lafroscia.com" }
],
"repository": {

2
gun.js
View File

@ -323,7 +323,7 @@
Chain.path = function(path){ // The focal point follows the path
var gun = this.chain();
path = (path || '').split('.');
gun.back.shot.then(function(node){ // should handle blank and err! Err already handled?
gun.back.shot.then(function trace(node){ // should handle blank and err! Err already handled?
if(!node){ return gun.shot('then').fire() } // TODO: BUG? ERROR? MAYBE? MARK?
gun.field = null;
gun._.node = node;

View File

@ -324,7 +324,7 @@ describe('Gun', function(){
done();
});
});
it('load', function(done){
gun.load('hello/world').get(function(val){
expect(val.hello).to.be('world');
@ -352,6 +352,29 @@ describe('Gun', function(){
done();
});
});
it.skip('var set key path', function(done){ // contexts should be able to be saved to a variable
var foo = gun.set({foo: 'bar'}).key('foo/bar');
foo.path('hello.world.nowhere')// this should only change the context temporarily
setTimeout(function(){
foo.path('foo').get(function(val){ // and then be reused from the same original context
console.log('?', val);
expect(val).to.be('bar'); // this should work
done();
});
}, 100);
});
it.skip('var load path', function(done){ // contexts should be able to be saved to a variable
var foo = gun.load('foo/bar');
foo.path('hello.world.nowhere')// this should only change the context temporarily
setTimeout(function(){
foo.path('foo').get(function(val){ // and then be reused from the same original context
expect(val).to.be('bar'); // this should work
done();
});
}, 100);
});
it('path', function(done){
console.log("fix path!");