Skip to content

Instantly share code, notes, and snippets.

@logicalparadox
Forked from c4milo/runner.html
Created December 19, 2011 19:12
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 logicalparadox/1498455 to your computer and use it in GitHub Desktop.
Save logicalparadox/1498455 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>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>
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();
});
});
@kArma34
Copy link

kArma34 commented Oct 8, 2018

Run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment