2011-09-09 05:23:07 +00:00
|
|
|
QUnit.specify("postal.js", function(){
|
2012-03-22 05:34:53 +00:00
|
|
|
describe("ChannelDefinition", function(){
|
|
|
|
|
describe("When initializing a channel definition", function() {
|
|
|
|
|
var chDef = new ChannelDefinition("TestChannel", "TestTopic");
|
|
|
|
|
it("should set channel to TestChannel", function(){
|
|
|
|
|
assert(chDef.channel).equals("TestChannel");
|
|
|
|
|
});
|
|
|
|
|
it("should set topic to TestTopic", function(){
|
|
|
|
|
assert(chDef._topic).equals("TestTopic");
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
describe("When calling subscribe", function() {
|
|
|
|
|
var ch = new ChannelDefinition("TestChannel", "TestTopic"),
|
|
|
|
|
sub = ch.subscribe(function(){ });
|
|
|
|
|
it("subscription should be instance of SubscriptionDefinition", function(){
|
|
|
|
|
assert(sub instanceof SubscriptionDefinition).isTrue();
|
|
|
|
|
});
|
|
|
|
|
});
|
2012-03-27 14:50:59 +00:00
|
|
|
describe("When calling topic", function() {
|
|
|
|
|
var ch = new ChannelDefinition("TestChannel", "TestTopic"),
|
|
|
|
|
ch2 = ch.topic("TestTopic2");
|
|
|
|
|
it("new channel should be of type ChannelDefinition", function(){
|
|
|
|
|
assert(ch2 instanceof ChannelDefinition).isTrue();
|
|
|
|
|
});
|
|
|
|
|
it("new channel should have topic of TestTopic2", function(){
|
|
|
|
|
assert(ch2._topic).equals("TestTopic2");
|
|
|
|
|
});
|
|
|
|
|
});
|
2012-03-22 05:34:53 +00:00
|
|
|
});
|
2011-09-09 05:23:07 +00:00
|
|
|
});
|