Skip to content

Instantly share code, notes, and snippets.

@thepatrick
Forked from ggarber/gist:969353cd878d5e87d041
Last active August 29, 2015 14:16
Show Gist options
  • Save thepatrick/7e2deb2f48ae2e3eb24b to your computer and use it in GitHub Desktop.
Save thepatrick/7e2deb2f48ae2e3eb24b to your computer and use it in GitHub Desktop.
var test = require('./helpers');
// Single endpoint:
// Connect and check the properties of the connection
test(function($) {
return $(0).connect().then(function(connection) {
$.expect(connection).is.any.connection();
});
});
// Two endpoints:
// Connect and Publish + Connect and Subscribe
// wait function just for fun, not needed for this example
test(function($) { // for performance reasons all tests in a kit should have the some number of endpoints
$(0).connect().publish();
$(1).connect();
return $(1).on('stream', 'created', function(stream) {
// TODO: Think about replacing $(0).session() with $('0.session')
$.expect(stream).to.be.any.stream({ withConnection: $('0.session') }););
return stream.subscribe().wait(2000).pass();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment