Created
September 16, 2012 03:16
-
-
Save ksato9700/3730889 to your computer and use it in GitHub Desktop.
mocha iterative test case example
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
class Client | |
constructor: (name, ready)-> | |
setTimeout => | |
@name = name | |
ready() | |
, 1000 | |
exports.Client = Client |
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
async = require 'async' | |
assert = require 'assert' | |
client = require '../client' | |
NAMES = [ | |
"jp00_basic", | |
"us00_basic", | |
"gb00_basic", | |
] | |
cps = {} | |
gencheck = (name)-> | |
-> | |
assert.equal cps[name].name, name | |
describe 'User', -> | |
before (done)-> | |
async.forEach NAMES, (name, cb)-> | |
cps[name] = new client.Client name, cb | |
, (err)-> | |
assert.equal err, null | |
done() | |
for name in NAMES | |
it "should have a name (#{name})", gencheck(name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment