Skip to content

Commit

Permalink
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/shared-method.js
Original file line number Diff line number Diff line change
@@ -65,6 +65,7 @@ function SharedMethod(fn, name, sc, options) {
this.fn = fn;
fn = fn || {};
this.name = name;
assert(typeof name === 'string', 'The method name must be a string');
options = options || {};
this.aliases = options.aliases || [];
var isStatic = this.isStatic = options.isStatic || false;
11 changes: 11 additions & 0 deletions test/shared-method.test.js
Original file line number Diff line number Diff line change
@@ -38,5 +38,16 @@ describe('SharedMethod', function() {
assert.equal(sharedMethod.isDelegateFor('myAlias', true), true);
assert.equal(sharedMethod.isDelegateFor('myAlias', false), false);
});

it('checks if the given name is a string', function () {
var mockSharedClass = {};
var err;
try {
var sharedMethod = new SharedMethod(myFunction, Number, mockSharedClass);
} catch(e) {
err = e;
}
assert(err);
});
});
});

0 comments on commit 17cffc1

Please sign in to comment.