test('route naming', function (t) { t.plan(8) resetAgent(function (data) { assert(t, data) server.close() }) var server = startServer(function (port) { http.get('http://localhost:' + port + '/hello', function (res) { t.strictEqual(res.statusCode, 200) res.on('data', function (chunk) { t.strictEqual(chunk.toString(), 'hello world') }) }) }) })
test('nested routes with params', function (t) { t.plan(8) resetAgent(function (data) { assert(t, data, { name: 'GET /prefix1/prefix2/hello/:name' }) server.close() }) var server = startServer(function (port) { http.get('http://localhost:' + port + '/prefix1/prefix2/hello/thomas', function (res) { t.strictEqual(res.statusCode, 200) res.on('data', function (chunk) { t.strictEqual(chunk.toString(), 'hello thomas') }) }) }) })
test('route naming with params', function (t) { t.plan(8) resetAgent(function (data) { assert(t, data, { name: 'GET /hello/:name' }) server.close() }) var server = startServer(function (port) { http.get('http://localhost:' + port + '/hello/thomas', function (res) { t.strictEqual(res.statusCode, 200) res.on('data', function (chunk) { t.strictEqual(chunk.toString(), 'hello thomas') }) }) }) })
test('nested routes', function (t) { t.plan(8) resetAgent(function (data) { assert(t, data, { name: 'GET /prefix1/prefix2/hello' }) server.close() }) var server = startServer(function (port) { http.get('http://localhost:' + port + '/prefix1/prefix2/hello', function (res) { t.strictEqual(res.statusCode, 200) res.on('data', function (chunk) { t.strictEqual(chunk.toString(), 'hello world') }) }) }) })