Skip to content

Instantly share code, notes, and snippets.

@ggarber
Created March 9, 2015 07:24
Show Gist options
  • Save ggarber/969353cd878d5e87d041 to your computer and use it in GitHub Desktop.
Save ggarber/969353cd878d5e87d041 to your computer and use it in GitHub Desktop.
JQuerized Assimilator DSL v.0.1 (but works :))
var test = require('./helpers');
// Single endpoint:
// Connect and check the properties of the connection
test(function($) {
$(0).connect().then(function(connection) {
$.assert.isNotNull(connection.connectionId);
connection.pass();
});
});
// Two endpoints:
// Connect and Publish + Connect and Subscribe
// wait function just for fun, not needed for this example
test({ endpoints: 2 }, function($) {
$(0).connect().publish();
$(1).connect();
$(1).on('stream', 'created', function(stream) {
// TODO: Think about replacing $(0).session() with $('0.session')
$.assert.deepEqual(stream.connection, $(0).session().connection);
stream.subscribe().wait(2000).pass();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment