Skip to content

Commit 4be19ba

Browse files
committed
Added test case to cover issue #27
1 parent ef0e562 commit 4be19ba

File tree

1 file changed

+35
-2
lines changed

1 file changed

+35
-2
lines changed

test/unit/cocktail.js

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,11 @@ describe('cocktail', function(){
188188
describe('Use', function(){
189189

190190
describe('use(Class)', function(){
191-
var MyAnnotation = function(){},
192-
processors;
193191

194192
it('adds MyAnnotation Class as a custom processor', function(){
193+
var MyAnnotation = function(){},
194+
processors;
195+
195196
MyAnnotation.prototype.name = '@myannotation';
196197

197198
cocktail.use(MyAnnotation);
@@ -204,6 +205,38 @@ describe('cocktail', function(){
204205

205206
});
206207

208+
it('does not add MyAnnotation Class as a custom processor if name doesn\'t start wiht @', function(){
209+
var MyAnnotation = function(){},
210+
processors;
211+
212+
MyAnnotation.prototype.name = 'myannotation';
213+
214+
cocktail.use(MyAnnotation);
215+
216+
processors = cocktail.getProcessors();
217+
218+
expect(processors).to.not.have.property('@myannotation');
219+
220+
expect(processors['@myannotation']).to.be.equal(undefined);
221+
222+
});
223+
224+
it('does not add MyAnnotation Class as a custom processor if name is not defined in prototype', function(){
225+
var MyAnnotation = function myannotation(){},
226+
processors;
227+
228+
expect(MyAnnotation.name).to.be.equal('myannotation');
229+
230+
cocktail.use(MyAnnotation);
231+
232+
processors = cocktail.getProcessors();
233+
234+
expect(processors).to.not.have.property('@myannotation');
235+
236+
expect(processors['@myannotation']).to.be.equal(undefined);
237+
238+
});
239+
207240
});
208241

209242

0 commit comments

Comments
 (0)