Skip to content

Instantly share code, notes, and snippets.

@jcreamer898
Created August 13, 2012 16:39
Show Gist options
  • Save jcreamer898/3342410 to your computer and use it in GitHub Desktop.
Save jcreamer898/3342410 to your computer and use it in GitHub Desktop.
Unit testing amplifyjs with qunit and sinon
module( "Product Viewer Personalization",
{
setup: function() {
OTC.App = {};
OTC.App.publish = amplify.publish;
OTC.App.on = amplify.subscribe;
OTC.App.off = amplify.unsubscribe;
this.pzn = new OTC.ProductViewer.Personalization();
}
});
test( "Personalizing a product", function() {
ok( this.pzn );
sinon.spy( this.pzn, "personalize" );
OTC.App.publish( "personalization.personalize" );
ok( this.pzn.personalize.calledOnce );
});
OTC.ProductViewer.Personalization = OTC.ProductViewer.Module.extend({
init: function() {
_.bindAll( this );
OTC.App.on( "personalization.personalize", this.personalize);
},
personalize: function() {
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment