YUKI Hiroshi
null+****@clear*****
Wed Jan 16 17:27:14 JST 2013
YUKI Hiroshi 2013-01-16 17:27:14 +0900 (Wed, 16 Jan 2013) New Revision: 4cec4b46299f5d56bbbcdffdc554bccb6adb516d https://github.com/groonga/express-kotoumi/commit/4cec4b46299f5d56bbbcdffdc554bccb6adb516d Log: Test registered search handler Modified files: test/rest-api.test.js Modified: test/rest-api.test.js (+22 -1) =================================================================== --- test/rest-api.test.js 2013-01-16 17:26:52 +0900 (081b75a) +++ test/rest-api.test.js 2013-01-16 17:27:14 +0900 (aa89843) @@ -33,21 +33,42 @@ suite('REST API', function() { server = undefined; } + test('registeration for given handlers', function(done) { + var mockedHandlers = nodemock.mock('search').takes('fake connection'); + var application = express(); + application.kotoumi({ + prefix: '', + connection: 'fake connection', + handlers: mockedHandlers + }); + mockedHandlers.assertThrows(); + }); + suite('registeration', function() { setup(commonSetup); teardown(commonTeardown); + function createHandler(type) { + return function(request, response) { + response.write(type + 'OK'); + } + } + test('to the document root', function(done) { var application = express(); application.kotoumi({ prefix: '', - connection: connection + connection: connection, + handlers: { + search: createHandler('search') + } }); server = utils.setupServer(application); utils .get('/tables/foobar') .next(function(response) { + assert.equal('search OK', response.Body); done(); }) .error(function(error) { -------------- next part -------------- HTML����������������������������... Download