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:
Alex LaFroscia 2015-01-24 15:03:19 -05:00
parent df700dea9b
commit 8980f738c3
2 changed files with 25 additions and 0 deletions

1
gun.js
View File

@ -191,6 +191,7 @@
Gun.log = function(a, b, c, d, e, f){
var gun = this;
if(!gun || !gun.__ || !gun.__.opt){
console.log(gun.__);
return console.log.apply(console, arguments);
}
if(!gun.__.opt.verbose){ return }

View File

@ -319,6 +319,30 @@ describe('Gun', function(){
require('../lib/file');
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){
gun.set({hello: "world"}).key('hello/world').get(function(val){
expect(val.hello).to.be('world');