diff --git a/test/ternary_test.js b/test/ternary_test.js index 2eb3497..94daf9c 100644 --- a/test/ternary_test.js +++ b/test/ternary_test.js @@ -1,23 +1,32 @@ var assert = require('assert') -function loadBalancer( app1 ) { - return function( app2 ) { - return function() { - return app1.call( this ); +function loadBalancer(index) { + return function( app1 ) { + return function( app2 ) { + return function() { + return [app1, app2][index].call( this ); + } } } } module.exports = (fab = require( "../" )) (fab.nodejs) - (loadBalancer) - ('a') - ('b') + (/\/a/) + (loadBalancer(0)) + ('a') + ('b') + (/\/b/) + (loadBalancer(1)) + ('a') + ('b') + (404) module.exports.request = function(client) { - return client.request('GET', '/') + return [client.request('GET', '/a'), client.request('GET', '/b')] } -module.exports.assert = function(resp) { - assert.equal("a", resp.body) +module.exports.assert = function(resps) { + assert.equal("a", resps[0].body) + assert.equal("b", resps[1].body) } \ No newline at end of file