Skip to content

Commit

Permalink
Agrego estructura para ArrayBasicInterface
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoefe committed Jun 7, 2016
1 parent e83f36d commit 18f806b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
13 changes: 13 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,17 @@ BasicInterfaces.prototype.plain = function plain(definition){
return this.init(new PlainBasicInterface(definition));
};

class ArrayBasicInterface extends ParametrizedInterface {
constructor(definition){
super(definition);
if(constructorName(definition) !== 'Array') {
throw new TypeError('definition should be an Array');
}
}
}

BasicInterfaces.prototype.array = function array(definition){
return this.init(new ArrayBasicInterface(definition));
};

module.exports = BasicInterfaces;
9 changes: 9 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,15 @@ describe("basic-interfaces", function(){
});
});
});
describe('array', function(){
describe("input errors", function(){
it("constructor(definition)", function(){
assertCatch(function() {
basicInterfaces.array({});
}, /definition should be an Array/);
});
});
});
describe('coverage', function(){
it('default options', function() {
sinon.stub(console, 'log', function() {});
Expand Down

0 comments on commit 18f806b

Please sign in to comment.