-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Vladimir Spasic
authored and
Vladimir Spasic
committed
Dec 14, 2014
1 parent
ea8a289
commit 5a83923
Showing
1 changed file
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
var chai = require('chai'), | ||
Module = require('../module'); | ||
|
||
var assert = chai.assert, | ||
expect = chai.expect; | ||
|
||
describe('Module', function() { | ||
|
||
describe('#getName', function() { | ||
|
||
it('should return name', function() { | ||
var module = Module.create({ | ||
name: 'module' | ||
}); | ||
|
||
assert.deepEqual(module.getName(), 'module'); | ||
}); | ||
|
||
}); | ||
|
||
describe('#getRequirements', function() { | ||
|
||
it('should return a list of requirements from a string', function() { | ||
var module = Module.create({ | ||
requires: 'module' | ||
}); | ||
|
||
assert.deepEqual(module.getRequirements(), ['module']); | ||
}); | ||
|
||
it('should return a list of requirements from an array', function() { | ||
var module = Module.create({ | ||
requires: ['module'] | ||
}); | ||
|
||
assert.deepEqual(module.getRequirements(), ['module']); | ||
}); | ||
|
||
it('should return an empty list', function() { | ||
var module = Module.create(); | ||
|
||
assert.deepEqual(module.getRequirements(), []); | ||
}); | ||
|
||
it('should throw an TypeError', function() { | ||
var module = Module.create({ | ||
requires: {} | ||
}); | ||
|
||
assert.throw(function() { | ||
module.getRequirements(); | ||
}, TypeError , 'Module \'requires\' property must be a String an Array'); | ||
}); | ||
|
||
}); | ||
|
||
}); |