-
-
Save logicalparadox/1498455 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Swarm Javascript Library Specifications</title> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
<link rel="stylesheet" href="../node_modules/mocha/mocha.css" charset="utf-8"/> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" | |
type="text/javascript" | |
charset="utf-8"> | |
</script> | |
<script src="../node_modules/mocha/mocha.js" | |
type="text/javascript" | |
charset="utf-8"> | |
</script> | |
<script src="http://cdn.buglabs.net/swarm/test/swarm-v0.3.2.js" | |
type="text/javascript" | |
charset="utf-8"> | |
</script> | |
<script>mocha.setup('bdd')</script> | |
<!-- Linking spec files --> | |
<script src="swarm.spec.js" | |
type="text/javascript" | |
charset="utf-8"> | |
</script> | |
<script> | |
onload = function() { | |
//var expect = chai.expect; | |
mocha.run(); | |
}; | |
</script> | |
</head> | |
<body> | |
<div id='mocha'/> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('Swarm Javascript API', function() { | |
it('should connect to the platform', function(done) { | |
SWARM.connect({ apikey: '3e98ac6ca152f9bc279d0ef6e6bc9877e1508fd8', | |
resource: '0da7ce672f5a2e067ee8a0e050ca3e363283ea39', | |
swarms: ['db07c1f9ff0628e33378cf39dc16df0755cdd3f0'], | |
onconnect: function() { | |
//true.should.be.true; | |
done(); | |
}, | |
onerror: function(errors) { | |
//failing on purpose since this function shouldn't be called. | |
//expect(errors.errors).to.be.empty; | |
throw new Error('This is an async test error.'); | |
}}); | |
}); | |
it('testing sync error', function(done) { | |
throw new Error('This is a sync error'); | |
done(); | |
}); | |
it('this an async error', function(done) { | |
// this throws an uncaught error in the console | |
setTimeout(function() { | |
throw new Error('testing async without swarm'); | |
done(); | |
}, 1000); | |
}); | |
it('should send public messages to specific swarms', function(done) { | |
done(); | |
}); | |
it('should send private messages', function(done) { | |
done(); | |
}); | |
it('should leave swarms', function(done) { | |
done(); | |
}); | |
it('should disconnect', function(done) { | |
done(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Run