Merge pull request #868 from rogowski/bug-850

Test for bug-850 - Saving a deep object under a user node seems to lose public key at some depth. Add test.
This commit is contained in:
rogowski 2020-04-23 21:45:06 -03:00 committed by GitHub
commit 06a4a0bfeb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 2 deletions

View File

@ -13,7 +13,7 @@
"https": "HTTPS_KEY=test/https/server.key HTTPS_CERT=test/https/server.crt npm start",
"prepublishOnly": "npm run unbuild",
"test": "mocha",
"testsea": "mocha test/sea.js",
"testsea": "mocha test/sea/sea.js",
"testaxe": "mocha test/axe/holy-grail.js",
"e2e": "mocha e2e/distributed.js",
"docker": "hooks/build",

21
test/sea/sea.js Normal file → Executable file
View File

@ -430,8 +430,27 @@ describe('SEA', function(){
},9);
});
});
});
it('User\'s nodes must be signed when on user scope!', function(done) {
/// https://github.com/amark/gun/issues/850
/// https://github.com/amark/gun/issues/616
this.timeout(9000);
var gun = Gun();
var user = gun.user();
user.auth('xavier', 'password');
gun.on('auth', function(){
user.get("testauthed").get("arumf").set({"this": "is", "an": {"obj2": "again2"}}, function(ack) {
var notsigned = [];
Gun.obj.map(gun._.graph, function(v,k) {
if (k[0]==='~' || k.indexOf('~', 1)!==-1) { return; } /// ignore '~pubkey' and '~@alias'
notsigned.push(k);
});
expect(notsigned.length).to.be(0); /// all souls must have to be suffixed with the user's pubkey.
done();
});
});
});
});
})
}());