Skip to content

Instantly share code, notes, and snippets.

@c4milo
Created December 19, 2011 15:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save c4milo/1497704 to your computer and use it in GitHub Desktop.
Save c4milo/1497704 to your computer and use it in GitHub Desktop.
<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 src="../node_modules/chai/chai.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() {
mocha.run();
require('chai').should();
};
</script>
</head>
<body>
<div id='mocha'/>
</body>
</html>
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.
errors.errors.should.be.empty();
}});
});
it('should join swarms and receive presence', function(done) {
done();
});
it('should send public messages to all the swarms where it has presence', function(done) {
done();
});
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