Merge 10549aad8286ce4542f4a966ea0300b2556cf830 into ff4bf9293c1afa85b09eb6027d841a611521c0c6

This commit is contained in:
rogowski 2025-03-18 11:00:31 +00:00 committed by GitHub
commit 7bb1cc9dc2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

52
test/bug/329.js Executable file
View File

@ -0,0 +1,52 @@
describe('Gun', function(){
var root;
(function(){
var env;
if(typeof global !== 'undefined'){ env = global }
if(typeof window !== 'undefined'){ env = window }
root = env.window? env.window : global;
try{ env.window && root.localStorage && root.localStorage.clear() }catch(e){}
try{ localStorage.clear() }catch(e){}
try{ indexedDB.deleteDatabase('radatatest') }catch(e){}
try{ require('fs').unlinkSync('data.json') }catch(e){}
try{ require('../../lib/fsrm')('radatatest') }catch(e){}
try{ var expect = global.expect = require("../expect") }catch(e){}
//root.Gun = root.Gun || require('../gun');
if(root.Gun){
root.Gun = root.Gun;
root.Gun.TESTING = true;
} else {
root.Gun = require('../../gun');
root.Gun.TESTING = true;
Gun.serve = require('../../lib/serve');
//require('../lib/file');
require('../../lib/store');
require('../../lib/rfs');
// require('../../lib/open');
// require('../../sea.js');
}
}(this));
var opt = { file: 'radatatest' };
describe('API - map', function(){
it('map and put', function(done) {
var gun = Gun(opt);
var ref = gun.get('pic').put({ empty: true }, function(ack) {
// console.log('added pic');
ref.get('people').put({a:{b:{c:true}}}, function(ack) {
// console.log('updated pic', ack);
if (ack && ack.err) { console.log('ERR: ', ack); expect(!ack.err).to.be(true); done(); }
ref.get('a').get('b').get('c').once(function(v) {
expect(v).to.be(true);
done();
});
// ref.open(function(v) {
// var s = JSON.stringify(v);
// expect(s==='{"empty":true,"people":{"a":{"b":{"c":true}}}}').to.be(true);
// done();
// });
});
});
});
});
});