Sha256: e371d4d5175406ed3c09688bf994ee19fa367ecabf36b372b63bf152a617928a
Contents?: true
Size: 1.21 KB
Versions: 10
Compression:
Stored size: 1.21 KB
Contents
var path = require('path'), events = require('events'), assert = require('assert'), fs = require('fs'), vows = require('../lib/vows'); function doSomethingAsync(callback) { var err = null; var testValue = 'a'; process.nextTick(function() { callback(err, testValue); }); } function doSomethingAsyncWithError(callback) { var err = true; var testValue = 'a'; process.nextTick(function() { callback(err, testValue); }); } vows.describe('vows/error').addBatch({ 'Generate success response to async function': { topic: function() { doSomethingAsync(this.callback) }, 'Validate success': function(err, testValue) { assert.ok(!err); }, 'Validate testValue': function(err, testValue) { assert.equal(testValue, 'a'); } }, 'Generate error response to async function': { topic: function() { doSomethingAsyncWithError(this.callback) }, 'Validate error': function(err, testValue) { assert.ok(err); }, 'Validate testValue': function(err, testValue) { // This assertion fails. It shouldn't. assert.equal(testValue, 'a'); } } }).export(module)
Version data entries
10 entries across 10 versions & 1 rubygems