From 5fcb314dfe7ee5265b0355e5f6f9eadf06b89a8c Mon Sep 17 00:00:00 2001 From: Mark Nadal Date: Fri, 1 Apr 2016 19:16:03 -0700 Subject: [PATCH] PANIC IS COMING! :D --- test/panic.html | 10 ++++++++++ test/test.panic.js | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 test/panic.html create mode 100644 test/test.panic.js diff --git a/test/panic.html b/test/panic.html new file mode 100644 index 00000000..aefe7c5b --- /dev/null +++ b/test/panic.html @@ -0,0 +1,10 @@ + + + + + + Happiness :D. + + \ No newline at end of file diff --git a/test/test.panic.js b/test/test.panic.js new file mode 100644 index 00000000..467dab18 --- /dev/null +++ b/test/test.panic.js @@ -0,0 +1,36 @@ +test(function(peers){ + console.log(peers.just); + peers.client(function(){ + console.log("JESSE FREAK OUT!"); + localStorage.clear(); + }); + + peers.env({ + key: 'SUPERPANICAWESOMESAUCEYAY', + url: 'http://gungame.herokuapp.com/gun' + }) + + peers.just("Alice", function(test){ + var gun = Gun(test.env.url); + gun.put({hello: 'WORLD HISTORY!!!!'}).key(this.env.key, function(err, ok){ + if(!err || (err.err || err).match('memory')){ + test.done(); + } + }); + }); + + ['bob', 'carl', 'dave', 'eve', 'fred'].forEach(function(name){ + console.log("PEERS!", name); + peers.just(name, function(test){ + var gun = Gun(test.env.url); + gun.get(this.env.key).val(function(data){ + console.log("BOB READ DATA", data); + if(data.hello === 'WORLD HISTORY!!!!'){ + test.done(); + } else { + test.fail("Data was corrupted"); + } + }); + }); + }); +}); \ No newline at end of file