mirror of
https://github.com/amark/gun.git
synced 2025-07-08 13:52:32 +00:00
Push failing tests
Currently some weird behavior is going on regarding `gun.__` being undefined, so I'm pushing so that Mark can check it out
This commit is contained in:
parent
df700dea9b
commit
8980f738c3
1
gun.js
1
gun.js
@ -191,6 +191,7 @@
|
|||||||
Gun.log = function(a, b, c, d, e, f){
|
Gun.log = function(a, b, c, d, e, f){
|
||||||
var gun = this;
|
var gun = this;
|
||||||
if(!gun || !gun.__ || !gun.__.opt){
|
if(!gun || !gun.__ || !gun.__.opt){
|
||||||
|
console.log(gun.__);
|
||||||
return console.log.apply(console, arguments);
|
return console.log.apply(console, arguments);
|
||||||
}
|
}
|
||||||
if(!gun.__.opt.verbose){ return }
|
if(!gun.__.opt.verbose){ return }
|
||||||
|
@ -319,6 +319,30 @@ describe('Gun', function(){
|
|||||||
require('../lib/file');
|
require('../lib/file');
|
||||||
var gun = Gun({file: 'data.json'});
|
var gun = Gun({file: 'data.json'});
|
||||||
|
|
||||||
|
it('verbose mode works properly', function(done) {
|
||||||
|
gun.load('hello/world').get(function() {
|
||||||
|
var counter = 2;
|
||||||
|
var originalLog = console.log;
|
||||||
|
|
||||||
|
/*
|
||||||
|
*console.log = function() {
|
||||||
|
* counter--;
|
||||||
|
*};
|
||||||
|
*/
|
||||||
|
|
||||||
|
Gun.log('this is a test');
|
||||||
|
gun.opt({verbose: true});
|
||||||
|
Gun.log('this is a test');
|
||||||
|
|
||||||
|
// Restore original console.log
|
||||||
|
console.log = originalLog;
|
||||||
|
expect(counter).to.be(1);
|
||||||
|
|
||||||
|
// Finish asynchronous mocha test
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('set key get', function(done){
|
it('set key get', function(done){
|
||||||
gun.set({hello: "world"}).key('hello/world').get(function(val){
|
gun.set({hello: "world"}).key('hello/world').get(function(val){
|
||||||
expect(val.hello).to.be('world');
|
expect(val.hello).to.be('world');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user