Skip to content

Instantly share code, notes, and snippets.

@danscotton
Created July 27, 2012 14:47
Show Gist options
  • Select an option

  • Save danscotton/3188452 to your computer and use it in GitHub Desktop.

Select an option

Save danscotton/3188452 to your computer and use it in GitHub Desktop.
empFacade tests
define('http://emp.bbci.co.uk/emp/clear/embed.js', function() {
var api = {
setWidth: sinon.spy(),
setHeight: sinon.spy(),
setDomId: sinon.spy(),
setPlaylist: sinon.spy(),
write: sinon.spy(),
setMediator: function() {},
set: function() {}
};
return {
Player: function() {
return api;
},
spies: api
};
});
define([
'module/bootstrap',
'module/media/empFacade',
'http://emp.bbci.co.uk/emp/clear/embed.js'
], function(
news,
EmpFacade,
emp
) {
module('EmpFacade', {
setup: function() {
this.options = {
playlist: 'playlists.bbc.co.uk',
id: 'video-12345',
width: 160,
height: 90
};
}
});
test('create an Emp.Player object and sets it up correctly', function() {
var empFacade = new EmpFacade(this.options);
ok(emp.spies.setWidth.calledWith(this.options.width));
ok(emp.spies.setHeight.calledWith(this.options.height));
ok(emp.spies.setDomId.calledWith(this.options.id));
ok(emp.spies.setPlaylist.calledWith(this.options.playlist));
ok(emp.spies.write.called);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment