Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added example test and updated label output
- Loading branch information
Showing
7 changed files
with
68 additions
and
10 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,11 @@ | ||
|
||
require.paths.unshift('../src'); | ||
|
||
require.paths.unshift('src'); | ||
require.paths.unshift('test'); | ||
|
||
var Runner = require('node_should').Runner; | ||
|
||
var runner = new Runner(); | ||
runner.run(); | ||
|
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,15 @@ | ||
|
||
var SomeClass = function() { | ||
this.isDone = false; | ||
this.name = 'default'; | ||
} | ||
|
||
SomeClass.prototype.doSomeLongAsyncTask = function(duration, callback) { | ||
var self = this; | ||
setTimeout(function() { | ||
self.isDone = true; | ||
callback(); | ||
}, duration); | ||
} | ||
|
||
exports.SomeClass = SomeClass; |
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,32 @@ | ||
|
||
var SomeClass = require('some_class').SomeClass; | ||
|
||
context('SomeClass', function() { | ||
|
||
setup(function() { | ||
this.instance1 = new SomeClass(); | ||
}); | ||
|
||
should('be instantiable', function() { | ||
assert.ok(this.instance1 instanceof SomeClass); | ||
}); | ||
|
||
should('do some long task', function() { | ||
var self = this; | ||
this.instance1.doSomeLongAsyncTask(10, this.async(function() { | ||
assert.ok(self.instance1.isDone, 'long async task completed'); | ||
})); | ||
}); | ||
|
||
context('with a custom name', function() { | ||
|
||
setup(function() { | ||
this.instance = new SomeClass(); | ||
this.instance.name = 'foo'; | ||
}); | ||
|
||
should('accept setter', function() { | ||
assert.equal('foo', this.instance.name); | ||
}); | ||
}); | ||
}); |
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
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
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
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