Skip to content

Instantly share code, notes, and snippets.

@dervalp
Created December 2, 2014 14:28
Show Gist options
  • Save dervalp/db4d2fbfce3a80ac8b94 to your computer and use it in GitHub Desktop.
Save dervalp/db4d2fbfce3a80ac8b94 to your computer and use it in GitHub Desktop.
unit test Component (even in node.js env)
var handlebars = require("handlebars");
global.__speak_config = {
template: handlebars
};
var Speak = require( "../../src/index" ),
should = require( "should" );
Speak.component({
name: "test",
initialize: function () {
console.log("initialize");
}
});
var component = Speak.component("test");
describe("Given Speak", function() {
it("should be defined", function (){
Speak.should.be.defined;
});
it("component method should exist", function (){
Speak.component.should.exist;
});
it("create a component", function (){
component.should.exist;
component.initialize.should.exist;
});
it("should be able to instanciate", function (){
var compProperties = {
key: "test",
id: "IdComponent"
};
var componentInstantiated = Speak.exposeComponent( compProperties, {} );
componentInstantiated.should.exist;
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment